This commit is contained in:
Kyle Burton
2018-08-25 17:58:05 -07:00
parent b718005a83
commit bc614b610c
178 changed files with 917 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
//loadColors("white-White,blue-Blue,colorlessLand-Colorless Land,gold-Gold")
function loadColors(colors) {
var endResult = ""
var colorList = colors.split(",")
for (i = 0; i < colorList.length; i++) {
endResult += "<option value='" + colorList[i].split("-")[0] + "'>" + colorList[i].split("-")[1] + "</option>"
}
document.getElementById("colorSelection").innerHTML = endResult
}

View File

@@ -0,0 +1,11 @@
function loadImage(event, destination, arg) {
if (arg != false) {
var input = event.target
var reader = new FileReader()
reader.onload = function() {
var dataURL = reader.result
destination.src = dataURL
}
reader.readAsDataURL(input.files[0])
}
}

View File

@@ -0,0 +1,8 @@
function loadScript(scriptName){
var script = document.createElement("script")
script.setAttribute("type","text/javascript")
script.setAttribute("src", scriptName)
if (typeof script != "undefined") {
document.getElementsByTagName("head")[0].appendChild(script)
}
}

View File

@@ -0,0 +1,26 @@
var mask = document.createElement("canvas")
var maskContext = mask.getContext("2d")
function drawMask(img, x, y, width, height, imgMask, secondMask, arg) {
mask.width = width
mask.height = height
maskContext.clearRect(0, 0, width, height)
maskContext.globalCompositeOperation = "source-over"
if (secondMask.src != undefined) {
maskContext.drawImage(secondMask, 0, 0, width, height)
if (arg == "reverseSecond") {
maskContext.globalCompositeOperation = "source-out"
} else {
maskContext.globalCompositeOperation = "source-in"
}
}
maskContext.drawImage(imgMask, 0, 0, width, height)
maskContext.globalCompositeOperation = "source-in"
if (img.src == undefined) {
maskContext.fillStyle = img
maskContext.fillRect(0, 0, width, height)
} else {
maskContext.drawImage(img, 0, 0, width, height)
}
card.drawImage(mask, x, y, width, height)
}