Flip Cards (front)

This commit is contained in:
Kyle
2018-10-22 20:47:12 -07:00
parent 2fcaa80341
commit 62aa7f505a
52 changed files with 92 additions and 46 deletions

View File

@@ -6,6 +6,7 @@ var legendaryBorder = false
var nyxBorder = false var nyxBorder = false
var miracleBorder = false var miracleBorder = false
var stampBorder = false var stampBorder = false
var flipBorder = false
//Loads the correct border data //Loads the correct border data
borderPath = "data/borders/" + document.getElementById("borderSelection").value borderPath = "data/borders/" + document.getElementById("borderSelection").value
loadScript(borderPath + "border.js") loadScript(borderPath + "border.js")

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
data/borders/icons/day.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
data/borders/icons/land.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
data/borders/icons/moon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -54,6 +54,7 @@ legendaryBorder = true
stampBorder = true stampBorder = true
nyxBorder = true nyxBorder = true
miracleBorder = true miracleBorder = true
flipBorder = true
//With all the new values in place, the program will update it's border images //With all the new values in place, the program will update it's border images
updateBorder() updateBorder()
//Any special functions go at the bottom //Any special functions go at the bottom

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -45,6 +45,19 @@
<br/> <br/>
<input type="checkbox" id="checkboxRareStamp" onchange="updateColor()">Rare Stamp</input> <input type="checkbox" id="checkboxRareStamp" onchange="updateColor()">Rare Stamp</input>
<br/> <br/>
<input type="checkbox" id="checkboxFlipIcon" onchange="updateColor()">Flip Icon <select id="inputFlipIcon" onchange="updateColor()">
<option value="blank.png">Blank</option>
<option value="day.png">Day</option>
<option value="night.png">Night</option>
<option value="compass.png">Compass</option>
<option value="moon.png">Moon</option>
<option value="eldrazi.png">Eldrazi</option>
<option value="planeswalker.png">Planeswalker</option>
</select></input>
<br/>
<input type="checkbox" id="checkboxFlipTip" onchange="updateColor()">Flip Tip
<input id="inputFlipTip" value="" type="text"></input>
<br/>
<input type="checkbox" id="checkboxSilverBorder">Silver Border</input> <input type="checkbox" id="checkboxSilverBorder">Silver Border</input>
<br/> <br/>
<input type="color" id="inputColor"> Border Color</input> <input type="color" id="inputColor"> Border Color</input>
@@ -395,11 +408,14 @@ a:active {
changeBorder() changeBorder()
//set up initial variables //set up initial variables
var borderPath var borderPath
var secondColor
var thirdColor
var titleRightShift = 0
//set up canvas //set up canvas
var canvas = document.getElementById("canvas") var canvas = document.getElementById("canvas")
var card = canvas.getContext("2d") var card = canvas.getContext("2d")
//Load dynamic images //Load dynamic images
var dynamicImageList = ["borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "secondBorderCreature", "thirdBorderCreature", "borderLegendary", "secondBorderLegendary", "thirdBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "art", "setSymbol", "watermark", "multiMask", "LegendMultiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "borderNyx", "secondBorderNyx", "thirdBorderNyx", "borderMiracle", "secondBorderMiracle", "thirdBorderMiracle"] var dynamicImageList = ["borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "borderLegendary", "secondBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "art", "setSymbol", "watermark", "multiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "borderNyx", "secondBorderNyx", "borderMiracle", "secondBorderMiracle", "borderFlipIcon", "borderFlipCircle", "borderFlipTip"]
for (i = 0; i < dynamicImageList.length; i ++) { for (i = 0; i < dynamicImageList.length; i ++) {
var imgName = "img" + dynamicImageList[i].charAt(0).toUpperCase() + dynamicImageList[i].slice(1) var imgName = "img" + dynamicImageList[i].charAt(0).toUpperCase() + dynamicImageList[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
@@ -457,10 +473,10 @@ setInterval(function() {
} }
//These are for pinpointing coordinates while adjusting values for new border types //These are for pinpointing coordinates while adjusting values for new border types
//Vertical Line //Vertical Line
//card.beginPath() // card.beginPath()
//card.moveTo(setSymbolRight, 0) // card.moveTo(688, 0)
//card.lineTo(setSymbolRight, 1044) // card.lineTo(688, 1044)
//card.stroke() // card.stroke()
//Horizontal Line //Horizontal Line
//card.beginPath() //card.beginPath()
//card.moveTo(0, setSymbolY) //card.moveTo(0, setSymbolY)
@@ -481,7 +497,6 @@ function updateBorder() {
imgFrameMask.src = borderPath + "frameMask.png" imgFrameMask.src = borderPath + "frameMask.png"
if (m15Info == true) { if (m15Info == true) {
imgLegendFrameMask.src = borderPath + "legendFrameMask.png" imgLegendFrameMask.src = borderPath + "legendFrameMask.png"
imgLegendMultiMask.src = borderPath + "legendMultiMask.png"
imgRareStampMask.src = borderPath + "rareStampMask.png" imgRareStampMask.src = borderPath + "rareStampMask.png"
imgBorderMask.src = borderPath + "borderMask.png" imgBorderMask.src = borderPath + "borderMask.png"
} else if (eighthInfo == true) { } else if (eighthInfo == true) {
@@ -492,33 +507,56 @@ function updateBorder() {
//Loads the images for the card frame, power toughness box, and rare stamp //Loads the images for the card frame, power toughness box, and rare stamp
function updateColor() { function updateColor() {
borderPath = "data/borders/" + document.getElementById("borderSelection").value borderPath = "data/borders/" + document.getElementById("borderSelection").value
var firstColor = borderPath + document.getElementById("colorSelection").value secondColor = document.getElementById("checkboxSecondColor").checked
var secondColor = borderPath + document.getElementById("secondColorSelection").value thirdColor = document.getElementById("checkboxThirdColor").checked
var thirdColor = borderPath + document.getElementById("thirdColorSelection").value var firstColorPath = borderPath + document.getElementById("colorSelection").value
imgBorderColor.src = firstColor + "/frame.png" var secondColorPath = borderPath + document.getElementById("secondColorSelection").value
imgSecondBorderColor.src = secondColor + "/frame.png" var thirdColorPath = borderPath + document.getElementById("thirdColorSelection").value
imgThirdBorderColor.src = thirdColor + "/frame.png" imgBorderColor.src = firstColorPath + "/frame.png"
imgBorderCreature.src = firstColor + "/pt.png" imgSecondBorderColor.src = secondColorPath + "/frame.png"
imgSecondBorderCreature.src = secondColor + "/pt.png" imgThirdBorderColor.src = thirdColorPath + "/frame.png"
imgThirdBorderCreature.src = thirdColor + "/pt.png" if (thirdColor == true) {
imgBorderCreature.src = thirdColorPath + "/pt.png"
} else if (secondColor == true) {
imgBorderCreature.src = secondColorPath + "/pt.png"
} else {
imgBorderCreature.src = firstColorPath + "/pt.png"
}
if (legendaryBorder == true) { if (legendaryBorder == true) {
imgBorderLegendary.src = firstColor + "/legendary.png" imgBorderLegendary.src = firstColorPath + "/legendary.png"
imgSecondBorderLegendary.src = secondColor + "/legendary.png" imgSecondBorderLegendary.src = secondColorPath + "/legendary.png"
imgThirdBorderLegendary.src = thirdColor + "/legendary.png"
} }
if (stampBorder == true) { if (stampBorder == true) {
imgBorderRareStamp.src = firstColor + "/stamp.png" imgBorderRareStamp.src = firstColorPath + "/stamp.png"
imgSecondBorderRareStamp.src = secondColor + "/stamp.png" imgSecondBorderRareStamp.src = secondColorPath + "/stamp.png"
} }
if (nyxBorder == true) { if (nyxBorder == true) {
imgBorderNyx.src = firstColor + "/nyx.png" if (thirdColor == true) {
imgSecondBorderNyx.src = secondColor + "/nyx.png" imgBorderNyx.src = thirdColorPath + "/nyx.png"
imgThirdBorderNyx.src = thirdColor + "/nyx.png" } else {
imgBorderNyx.src = firstColorPath + "/nyx.png"
imgSecondBorderNyx.src = secondColorPath + "/nyx.png"
}
} }
if (miracleBorder == true) { if (miracleBorder == true) {
imgBorderMiracle.src = firstColor + "/miracle.png" if (thirdColor == true) {
imgSecondBorderMiracle.src = secondColor + "/miracle.png" imgBorderMiracle.src = thirdColorPath + "/miracle.png"
imgThirdBorderMiracle.src = thirdColor + "/miracle.png" } else {
imgBorderMiracle.src = firstColorPath + "/miracle.png"
imgSecondBorderMiracle.src = secondColorPath + "/miracle.png"
}
}
if (flipBorder == true) {
if (secondColor == true) {
imgBorderFlipTip.src = secondColorPath + "/flipTip.png"
} else {
imgBorderFlipTip.src = firstColorPath + "/flipTip.png"
}
titleRightShift = 50
imgBorderFlipCircle.src = firstColorPath + "/flipCircle.png"
imgBorderFlipIcon.src = "data/borders/icons/" + document.getElementById("inputFlipIcon").value
} else {
titleRightShift = 0
} }
} }
//Draw Picture //Draw Picture
@@ -537,10 +575,10 @@ function drawBorder() {
//These if else statements check to see whether or not to draw different parts of the card, like the legendary border or rare stamp, and draws them in the appropriate order such that when multiple border colors are used the gradients overlap correctly //These if else statements check to see whether or not to draw different parts of the card, like the legendary border or rare stamp, and draws them in the appropriate order such that when multiple border colors are used the gradients overlap correctly
//MAIN CARD FRAME //MAIN CARD FRAME
drawMask(imgBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false)
if (document.getElementById("checkboxSecondColor").checked == true) { if (secondColor == true) {
drawMask(imgSecondBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
if (document.getElementById("checkboxThirdColor").checked == true) { if (thirdColor == true) {
drawMask(imgThirdBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false) drawMask(imgThirdBorderColor, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false)
} }
//Draws the silver border usually on un-cards //Draws the silver border usually on un-cards
@@ -561,22 +599,22 @@ function drawBorder() {
} }
//NYX //NYX
if (document.getElementById("checkboxNyx").checked == true && nyxBorder == true) { if (document.getElementById("checkboxNyx").checked == true && nyxBorder == true) {
if (document.getElementById("checkboxThirdColor").checked == true) { if (thirdColor == true) {
drawMask(imgThirdBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false) drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiMask, false)
} else { } else {
drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false)
if (document.getElementById("checkboxSecondColor").checked == true) { if (secondColor == true) {
drawMask(imgSecondBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderNyx, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
} }
} }
//MIRACLE //MIRACLE
if (document.getElementById("checkboxMiracle").checked == true && miracleBorder == true) { if (document.getElementById("checkboxMiracle").checked == true && miracleBorder == true) {
if (document.getElementById("checkboxThirdColor").checked == true) { if (thirdColor == true) {
drawMask(imgThirdBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false)
} else { } else {
drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false) drawMask(imgBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, false, false)
if (document.getElementById("checkboxSecondColor").checked == true) { if (secondColor == true) {
drawMask(imgSecondBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderMiracle, 0, 0, canvas.width, canvas.height, imgFrameMask, imgMultiGradient, "reverseSecond")
} }
} }
@@ -584,7 +622,7 @@ function drawBorder() {
//LEGENDARY //LEGENDARY
if (document.getElementById("checkboxLegendary").checked == true && legendaryBorder == true) { if (document.getElementById("checkboxLegendary").checked == true && legendaryBorder == true) {
drawMask(imgBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, false, false) drawMask(imgBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, false, false)
if (document.getElementById("checkboxSecondColor").checked == true) { if (secondColor == true) {
drawMask(imgSecondBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, imgMultiGradient, "reverseSecond") drawMask(imgSecondBorderLegendary, 0, 0, canvas.width, canvas.height, imgLegendFrameMask, imgMultiGradient, "reverseSecond")
} }
//redraws the custom-color border to match the legendary frame //redraws the custom-color border to match the legendary frame
@@ -594,6 +632,18 @@ function drawBorder() {
drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, imgBorderMask, imgLegendFrameMask, "reverseSecond") drawMask("#a3aeb7", 0, 0, canvas.width, canvas.height, imgBorderMask, imgLegendFrameMask, "reverseSecond")
} }
} }
//FLIP CARDS
if (document.getElementById("checkboxFlipIcon").checked == true && flipBorder == true) {
card.drawImage(imgBorderFlipCircle, 0, 0, canvas.width, canvas.height)
card.drawImage(imgBorderFlipIcon, 39, 51, 60, 60)
}
if (document.getElementById("checkboxFlipTip").checked == true && flipBorder == true) {
card.drawImage(imgBorderFlipTip, 0, 0, canvas.width, canvas.height)
card.fillStyle="#666"
canvas.style.letterSpacing = "0px"
card.font = "28px belerenb"
card.fillText(document.getElementById("inputFlipTip").value, 688 - card.measureText(document.getElementById("inputFlipTip").value).width, 880)
}
} }
//Draw Set Symbol //Draw Set Symbol
function drawSetSymbol() { function drawSetSymbol() {
@@ -661,7 +711,7 @@ function writeText() {
//Title //Title
canvas.style.letterSpacing = titleFontSpacing canvas.style.letterSpacing = titleFontSpacing
card.font = titleFont card.font = titleFont
card.fillText(document.getElementById("inputName").value, titleX, titleY) card.fillText(document.getElementById("inputName").value, titleX + titleRightShift, titleY)
//Type //Type
canvas.style.letterSpacing = typeFontSpacing canvas.style.letterSpacing = typeFontSpacing
card.font = typeFont card.font = typeFont
@@ -673,13 +723,7 @@ function writeText() {
drawText(text, textX, textY) drawText(text, textX, textY)
//Power/Toughness //Power/Toughness
if (document.getElementById("checkboxCreature").checked == true) { if (document.getElementById("checkboxCreature").checked == true) {
if (document.getElementById("checkboxThirdColor").checked == true) { card.drawImage(imgBorderCreature, ptX, ptY, ptWidth, ptHeight)
card.drawImage(imgThirdBorderCreature, ptX, ptY, ptWidth, ptHeight)
} else if (document.getElementById("checkboxSecondColor").checked == true) {
card.drawImage(imgSecondBorderCreature, ptX, ptY, ptWidth, ptHeight)
} else {
card.drawImage(imgBorderCreature, ptX, ptY, ptWidth, ptHeight)
}
canvas.style.letterSpacing = ptFontSpacing canvas.style.letterSpacing = ptFontSpacing
card.font = ptFont card.font = ptFont
powerToughness = document.getElementById("inputPowerToughness").value powerToughness = document.getElementById("inputPowerToughness").value
@@ -770,7 +814,7 @@ function drawText(text, xCoord, yCoord) {
line = testLine + " " line = testLine + " "
} }
if (wordIndex + 1 == words.length) { if (wordIndex + 1 == words.length) {
card.fillText(line, x + textXShift, y) card.fillText(line, x + textXShift, y)
} }
} else { } else {
//Symbols and more! //Symbols and more!
@@ -839,7 +883,7 @@ function drawText(text, xCoord, yCoord) {
line = testLine line = testLine
} }
if (wordIndex + 1 == words.length) { if (wordIndex + 1 == words.length) {
card.fillText(line, x + textXShift, y) card.fillText(line, x + textXShift, y)
} }
} }
} }
@@ -871,7 +915,7 @@ function loadSetSymbol() {
//Best for last - downloads the image! //Best for last - downloads the image!
function downloadCardImage(el) { function downloadCardImage(el) {
alert("This may not work because the canvas is 'tainted' - if you know how to avoid this please tell me") alert("This may not work because the canvas is 'tainted' - if you know how to avoid this please tell me")
var cardImageData = canvas.toDataURL("image/jpg") var cardImageData = canvas.toDataURL()
el.href = cardImageData el.href = cardImageData
} }
</script> </script>