This commit is contained in:
Kyle
2018-11-19 12:19:35 -08:00
parent 265e579993
commit 350128fff3
5 changed files with 20 additions and 23 deletions

View File

@@ -8,9 +8,6 @@ imgRareStampMask.src = borderPath + "rareStampMask.png"
imgBorderMask.src = borderPath + "borderMask.png" imgBorderMask.src = borderPath + "borderMask.png"
imgAbilityLineOdd.src = borderPath + "abilityLineOdd.png" imgAbilityLineOdd.src = borderPath + "abilityLineOdd.png"
imgAbilityLineEven.src = borderPath + "abilityLineEven.png" imgAbilityLineEven.src = borderPath + "abilityLineEven.png"
imgLoyaltyUp.src = borderPath + "loyaltyUp.png"
imgLoyaltyDown.src = borderPath + "loyaltyDown.png"
imgLoyaltyZero.src = borderPath + "loyaltyZero.png"
document.getElementById("textSize").value = 33 document.getElementById("textSize").value = 33
//Card Title //Card Title
var titleFont = "40px belerenb" //40 var titleFont = "40px belerenb" //40
@@ -79,14 +76,14 @@ function planeswalkerCustomFunction() {
card.fillStyle = "white" card.fillStyle = "white"
card.textAlign = "center" card.textAlign = "center"
card.font = "31px belerenbsc" card.font = "31px belerenbsc"
if (loyaltyValue.charAt(0) == "-" && imgLoyaltyDown.width > 0) { if (loyaltyValue.charAt(0) == "-") {
card.drawImage(imgLoyaltyDown, 34, abilityLineY + abilityLines[i] / 2 - 28, 84, 64) card.drawImage(manaSymbolImages[58], 34, abilityLineY + abilityLines[i] / 2 - 28, 84, 64)
card.fillText(loyaltyValue, 76, abilityLineY + abilityLines[i] / 2 - 22) card.fillText(loyaltyValue, 76, abilityLineY + abilityLines[i] / 2 - 22)
} else if (loyaltyValue.charAt(0) == "+" && imgLoyaltyUp.width > 0) { } else if (loyaltyValue.charAt(0) == "+") {
card.drawImage(imgLoyaltyUp, 34, abilityLineY + abilityLines[i] / 2 - 38, 82, 62) card.drawImage(manaSymbolImages[59], 34, abilityLineY + abilityLines[i] / 2 - 38, 82, 62)
card.fillText(loyaltyValue, 74, abilityLineY + abilityLines[i] / 2 - 24) card.fillText(loyaltyValue, 74, abilityLineY + abilityLines[i] / 2 - 24)
} else if (imgLoyaltyZero.width > 0) { } else {
card.drawImage(imgLoyaltyZero, 34, abilityLineY + abilityLines[i] / 2 - 28, 82, 56) card.drawImage(manaSymbolImages[60], 34, abilityLineY + abilityLines[i] / 2 - 28, 82, 56)
card.fillText(loyaltyValue, 74, abilityLineY + abilityLines[i] / 2 - 21) card.fillText(loyaltyValue, 74, abilityLineY + abilityLines[i] / 2 - 21)
} }
card.font = "37px mplantin" card.font = "37px mplantin"

BIN
data/manaSymbols/58.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
data/manaSymbols/59.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
data/manaSymbols/60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -23,8 +23,8 @@ var borderCanvas = document.createElement("canvas")
var border = borderCanvas.getContext("2d") var border = borderCanvas.getContext("2d")
//load template images (images that may change based off of the selected template) //load template images (images that may change based off of the selected template)
var imgListTemplate = ["multiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "artMask", "abilityLineOdd", "abilityLineEven", "loyaltyUp", "loyaltyDown", "loyaltyZero"] var imgListTemplate = ["multiMask", "rareStampMask", "frameMask", "legendFrameMask", "borderMask", "artMask", "abilityLineOdd", "abilityLineEven"]
for (i = 0; i < imgListTemplate.length; i ++) { for (var i = 0; i < imgListTemplate.length; i ++) {
var imgName = "img" + imgListTemplate[i].charAt(0).toUpperCase() + imgListTemplate[i].slice(1) var imgName = "img" + imgListTemplate[i].charAt(0).toUpperCase() + imgListTemplate[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
window[imgName].crossOrigin = "anonymous" window[imgName].crossOrigin = "anonymous"
@@ -32,7 +32,7 @@ for (i = 0; i < imgListTemplate.length; i ++) {
//Load border images (images that are determined by border settings) //Load border images (images that are determined by border settings)
var imgListBorder = ["borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "borderLegendary", "secondBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "borderNyx", "secondBorderNyx", "borderMiracle", "secondBorderMiracle", "borderFlipIcon", "borderFlipCircle", "borderFlipTip", "borderFlippedDark", "secondBorderFlippedDark"] var imgListBorder = ["borderColor", "secondBorderColor", "thirdBorderColor", "borderCreature", "borderLegendary", "secondBorderLegendary", "borderRareStamp", "secondBorderRareStamp", "borderNyx", "secondBorderNyx", "borderMiracle", "secondBorderMiracle", "borderFlipIcon", "borderFlipCircle", "borderFlipTip", "borderFlippedDark", "secondBorderFlippedDark"]
for (i = 0; i < imgListBorder.length; i ++) { for (var i = 0; i < imgListBorder.length; i ++) {
var imgName = "img" + imgListBorder[i].charAt(0).toUpperCase() + imgListBorder[i].slice(1) var imgName = "img" + imgListBorder[i].charAt(0).toUpperCase() + imgListBorder[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
window[imgName].crossOrigin = "anonymous" window[imgName].crossOrigin = "anonymous"
@@ -50,7 +50,7 @@ for (i = 0; i < imgListBorder.length; i ++) {
//Load dynamic images (images that are input by the user) //Load dynamic images (images that are input by the user)
var imgListUser = ["art", "setSymbol", "watermark", "border"] var imgListUser = ["art", "setSymbol", "watermark", "border"]
for (i = 0; i < imgListUser.length; i ++) { for (var i = 0; i < imgListUser.length; i ++) {
var imgName = "img" + imgListUser[i].charAt(0).toUpperCase() + imgListUser[i].slice(1) var imgName = "img" + imgListUser[i].charAt(0).toUpperCase() + imgListUser[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
window[imgName].crossOrigin = "anonymous" window[imgName].crossOrigin = "anonymous"
@@ -68,14 +68,14 @@ for (i = 0; i < imgListUser.length; i ++) {
//Load static images //Load static images
var imgListStatic = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "bar", "identity"] var imgListStatic = ["artistBrush", "foil", "stampGradient", "multiGradient", "rareStamp", "cardMask", "bar", "identity"]
for (i = 0; i < imgListStatic.length; i ++) { for (var i = 0; i < imgListStatic.length; i ++) {
var imgName = "img" + imgListStatic[i].charAt(0).toUpperCase() + imgListStatic[i].slice(1) var imgName = "img" + imgListStatic[i].charAt(0).toUpperCase() + imgListStatic[i].slice(1)
window[imgName] = new Image() window[imgName] = new Image()
window[imgName].src = "data/borders/" + imgListStatic[i] + ".png" window[imgName].src = "data/borders/" + imgListStatic[i] + ".png"
} }
//Mana symbol Array setup //Mana symbol Array setup
var manaSymbolCode = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "w", "u", "b", "r", "g", "2w", "2u", "2b", "2r", "2g", "pw", "pu", "pb", "pr", "pg", "wu", "wb", "ub", "ur", "br", "bg", "rg", "rw", "gw", "gu", "x", "s", "c", "t","untap", "e", "y", "z", "1/2", "inf", "chaos", "plane"] var manaSymbolCode = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "w", "u", "b", "r", "g", "2w", "2u", "2b", "2r", "2g", "pw", "pu", "pb", "pr", "pg", "wu", "wb", "ub", "ur", "br", "bg", "rg", "rw", "gw", "gu", "x", "s", "c", "t","untap", "e", "y", "z", "1/2", "inf", "chaos", "plane", "l+", "l-", "l0"]
var manaSymbolImages = new Array() var manaSymbolImages = new Array()
for (var i = 0; i < manaSymbolCode.length; i++) { for (var i = 0; i < manaSymbolCode.length; i++) {
manaSymbolImages[i] = new Image() manaSymbolImages[i] = new Image()
@@ -229,7 +229,7 @@ function updateBorder() {
//This allows all the images to be loaded //This allows all the images to be loaded
imagesToLoad = 0 imagesToLoad = 0
//Makes a count of all images that are loading, also tags them //Makes a count of all images that are loading, also tags them
for (i = 0; i < imgListBorder.length; i++) { for (var i = 0; i < imgListBorder.length; i++) {
if (imgListBorder[i].complete == false) { if (imgListBorder[i].complete == false) {
imagesToLoad ++ imagesToLoad ++
imgListBorder[i].hasToLoad = true imgListBorder[i].hasToLoad = true
@@ -361,7 +361,7 @@ function createBorder() {
default: default:
var originAngle = 0 var originAngle = 0
} }
for (i = 0; i < identityList.length; i ++) { for (var i = 0; i < identityList.length; i ++) {
switch (identityList[i]) { switch (identityList[i]) {
case "w": case "w":
border.fillStyle = "#f3f2ef" border.fillStyle = "#f3f2ef"
@@ -474,7 +474,7 @@ function drawManaCost() {
card.fillStyle = "Black" card.fillStyle = "Black"
var symbols = document.getElementById("inputCost").value.toLowerCase().split(" ") var symbols = document.getElementById("inputCost").value.toLowerCase().split(" ")
var xShift = 0 var xShift = 0
for (n = symbols.length; n > -1; n--) { for (var n = symbols.length; n > -1; n--) {
if (manaSymbolCode.indexOf(symbols[n]) != -1) { if (manaSymbolCode.indexOf(symbols[n]) != -1) {
card.beginPath() card.beginPath()
card.arc(manaCostX + xShift + manaCostRadius - 1, manaCostY + manaCostRadius + 3.5, manaCostRadius, 0, 6.29, false) card.arc(manaCostX + xShift + manaCostRadius - 1, manaCostY + manaCostRadius + 3.5, manaCostRadius, 0, 6.29, false)
@@ -585,7 +585,7 @@ function drawText(text, xCoord, yCoord) {
var words = (text).split(" ") var words = (text).split(" ")
var line = "" var line = ""
var tempTextWidth = textWidth var tempTextWidth = textWidth
for (wordIndex = 0; wordIndex < words.length; wordIndex ++) { for (var wordIndex = 0; wordIndex < words.length; wordIndex ++) {
if (words[wordIndex].includes("<") == false || words[wordIndex].includes(">") == false) { if (words[wordIndex].includes("<") == false || words[wordIndex].includes(">") == false) {
//Just a regular old word //Just a regular old word
testLine = line + words[wordIndex] testLine = line + words[wordIndex]
@@ -606,7 +606,7 @@ function drawText(text, xCoord, yCoord) {
} else { } else {
//Symbols and more! //Symbols and more!
var splitWord = words[wordIndex].split("<") var splitWord = words[wordIndex].split("<")
for (splitIndex = 0; splitIndex < splitWord.length; splitIndex ++) { for (var splitIndex = 0; splitIndex < splitWord.length; splitIndex ++) {
//Write what's there first! //Write what's there first!
card.fillText(line, x + textXShift, y) card.fillText(line, x + textXShift, y)
textXShift += card.measureText(line).width textXShift += card.measureText(line).width
@@ -695,7 +695,7 @@ function drawText(text, xCoord, yCoord) {
//============================================// //============================================//
//Toggles the visibility of predetermined sections of the input boxes //Toggles the visibility of predetermined sections of the input boxes
function toggleView(targetId, targetClass) { function toggleView(targetId, targetClass) {
for (i = 0; i < document.getElementsByClassName(targetClass).length; i++) { for (var i = 0; i < document.getElementsByClassName(targetClass).length; i++) {
document.getElementsByClassName(targetClass)[i].classList.remove("shown") document.getElementsByClassName(targetClass)[i].classList.remove("shown")
} }
document.getElementById(targetClass + "-" + targetId).classList.add("shown") document.getElementById(targetClass + "-" + targetId).classList.add("shown")
@@ -774,7 +774,7 @@ CanvasRenderingContext2D.prototype.mask = function(content, x, y, width, height)
mask.height = height mask.height = height
maskContext.clearRect(0, 0, width, height) maskContext.clearRect(0, 0, width, height)
var contentList = content.split(";") var contentList = content.split(";")
for (i = 0; i < contentList.length; i ++) { for (var i = 0; i < contentList.length; i ++) {
var currentContent = contentList[i].split(",") var currentContent = contentList[i].split(",")
maskContext.globalCompositeOperation = currentContent[1] maskContext.globalCompositeOperation = currentContent[1]
if (window[currentContent[0]] != undefined) { if (window[currentContent[0]] != undefined) {
@@ -879,7 +879,7 @@ function whiteToTransparent(targetImage) {
function loadColors(colors) { function loadColors(colors) {
var endResult = "" var endResult = ""
var colorList = colors.split(",") var colorList = colors.split(",")
for (i = 0; i < colorList.length; i++) { for (var i = 0; i < colorList.length; i++) {
endResult += "<option value='" + colorList[i].split("-")[0] + "'>" + colorList[i].split("-")[1] + "</option>" endResult += "<option value='" + colorList[i].split("-")[0] + "'>" + colorList[i].split("-")[1] + "</option>"
} }
document.getElementById("colorSelection").innerHTML = endResult document.getElementById("colorSelection").innerHTML = endResult