mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 21:31:39 -05:00
upgrayedd
This commit is contained in:
18
data/scripts/animations.js
Normal file
18
data/scripts/animations.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//CSS & HTML stuff
|
||||
window.layerElements = document.querySelectorAll('.layer')
|
||||
window.addEventListener('resize', windowResized)
|
||||
window.addEventListener('scroll', windowScrolled)
|
||||
windowResized()
|
||||
|
||||
function windowResized() {
|
||||
window.windowHeight = window.innerHeight
|
||||
windowScrolled()
|
||||
}
|
||||
function windowScrolled() {
|
||||
for (var i = 0; i < layerElements.length; i++) {
|
||||
var positionFromTop = (layerElements[i].getBoundingClientRect().top + layerElements[i].getBoundingClientRect().bottom) / 2
|
||||
if (positionFromTop - windowHeight <= 0) {
|
||||
layerElements[i].classList.add('revealedLayer')
|
||||
}
|
||||
}
|
||||
}
|
24
data/scripts/cookies.js
Normal file
24
data/scripts/cookies.js
Normal file
@@ -0,0 +1,24 @@
|
||||
function setCookie(cookieName, cookieValue, cookieTime = (5 * 365 * 24 * 60 * 60 * 1000)) { //years*days*hours*minutes*seconds*milliseconds
|
||||
var tempDate = new Date()
|
||||
tempDate.setTime(tempDate.getTime() + cookieTime)
|
||||
document.cookie = cookieName + '=' + cookieValue + ';expires=' + tempDate.toUTCString() + ';path=/'
|
||||
}
|
||||
function getCookie(cookieName) {
|
||||
var name = cookieName + '='
|
||||
var cookieArray = document.cookie.split(';')
|
||||
for(var i = 0; i < cookieArray.length; i++) {
|
||||
var tempCookie = cookieArray[i]
|
||||
while (tempCookie.charAt(0) == ' ') {
|
||||
tempCookie = tempCookie.substring(1)
|
||||
}
|
||||
if (tempCookie.indexOf(name) == 0) {
|
||||
return tempCookie.substring(name.length, tempCookie.length)
|
||||
}
|
||||
}
|
||||
return ''
|
||||
}
|
||||
function checkCookies() {
|
||||
if (getCookie('colorPalette') != undefined) {
|
||||
loadScript('data/scripts/' + getCookie('colorPalette') + '.js')
|
||||
}
|
||||
}
|
@@ -1,7 +1,9 @@
|
||||
rootStyles.setProperty('--background-color', '#1c1c1c');
|
||||
rootStyles.setProperty('--background-color-contrast', '#111');
|
||||
rootStyles.setProperty('--interactable-color', '#333');
|
||||
rootStyles.setProperty('--interactable-selected-color', '#444');
|
||||
rootStyles.setProperty('--input-color', '#555');
|
||||
rootStyles.setProperty('--font-color', '#fff');
|
||||
rootStyles.setProperty('--font-color-contrast', '#eee');
|
||||
rootStyles.setProperty('--background-color', '#1c1c1c')
|
||||
rootStyles.setProperty('--background-color-contrast', '#111')
|
||||
rootStyles.setProperty('--interactable-color', '#333')
|
||||
rootStyles.setProperty('--interactable-selected-color', '#555')
|
||||
rootStyles.setProperty('--input-color', '#3a3a3a')
|
||||
rootStyles.setProperty('--font-color', '#fff')
|
||||
rootStyles.setProperty('--font-color-contrast', '#eee')
|
||||
rootStyles.setProperty('--body-background', 'none')
|
||||
setCookie('colorPalette', 'darkMode')
|
@@ -1,7 +1,9 @@
|
||||
rootStyles.setProperty('--background-color', '#fafafa');
|
||||
rootStyles.setProperty('--background-color-contrast', '#222');
|
||||
rootStyles.setProperty('--interactable-color', '#aaa');
|
||||
rootStyles.setProperty('--interactable-selected-color', '#888');
|
||||
rootStyles.setProperty('--input-color', '#ddd');
|
||||
rootStyles.setProperty('--font-color', '#000');
|
||||
rootStyles.setProperty('--font-color-contrast', '#eee');
|
||||
rootStyles.setProperty('--background-color', '#fafafa')
|
||||
rootStyles.setProperty('--background-color-contrast', '#333')
|
||||
rootStyles.setProperty('--interactable-color', '#aaa')
|
||||
rootStyles.setProperty('--interactable-selected-color', '#777')
|
||||
rootStyles.setProperty('--input-color', '#ddd')
|
||||
rootStyles.setProperty('--font-color', '#000')
|
||||
rootStyles.setProperty('--font-color-contrast', '#eee')
|
||||
rootStyles.setProperty('--body-background', 'none')
|
||||
setCookie('colorPalette', 'lightMode')
|
@@ -5,8 +5,8 @@ var maskImageList = new Array()
|
||||
var maskNameList = new Array()
|
||||
var canvasList = new Array()
|
||||
var contextList = new Array()
|
||||
var cardWidth = 1500, cardHeight = 2100
|
||||
var loadedVersions = new Array()
|
||||
var currentVersion
|
||||
var cardMaster = document.getElementById('cardMaster')
|
||||
var selectedFrameImage
|
||||
var selectedMaskImage = 0
|
||||
@@ -29,6 +29,9 @@ function newCanvas(name) {
|
||||
window[name + 'Context'] = window[name + 'Canvas'].getContext('2d')
|
||||
contextList.push(window[name + 'Context'])
|
||||
}
|
||||
function resizeCanvases(newCardWidth, newCardHeight) {
|
||||
canvasList.forEach(element => {element.width = newCardWidth; element.height = newCardHeight})
|
||||
}
|
||||
|
||||
var previewCanvas = document.getElementById('previewCanvas')
|
||||
previewCanvas.width = 750
|
||||
@@ -43,6 +46,7 @@ newCanvas('bottomInfo')
|
||||
newCanvas('manaCost')
|
||||
newCanvas('watermark')
|
||||
newCanvas('temp')
|
||||
newCanvas('autoCrop')
|
||||
|
||||
var artWidth = cardWidth, artHeight = cardHeight
|
||||
var setSymbolDrawX, setSymbolDrawY, setSymbolDrawWidth, setSymbolDrawHeight
|
||||
@@ -76,6 +80,8 @@ setSymbol.onload = function() {
|
||||
setSymbolDrawX = setSymbolX[0]
|
||||
if (setSymbolX[1] == 'right') {
|
||||
setSymbolDrawX -= setSymbolDrawWidth
|
||||
} else if (setSymbolX[1] == 'center') {
|
||||
setSymbolDrawX -= setSymbolDrawWidth / 2
|
||||
}
|
||||
setSymbolDrawY = setSymbolY[0]
|
||||
if (setSymbolY[1] == 'center') {
|
||||
@@ -100,11 +106,18 @@ class cardPlaceholder {
|
||||
uniqueNumberTracker += 1
|
||||
}
|
||||
draw() {
|
||||
mainContext.globalAlpha = 1
|
||||
mainContext.drawImage(this.whatToDraw, scaleX(this.x), scaleY(this.y), scaleX(this.width) * this.zoom, scaleY(this.height) * this.zoom)
|
||||
if (this.whatToDraw == textCanvas) {
|
||||
if (currentVersion == 'planeswalker') {
|
||||
mainContext.drawImage(planeswalkerCanvas, 0, 0, cardWidth, cardHeight)
|
||||
}
|
||||
mainContext.globalAlpha = parseInt(document.getElementById('inputWatermarkOpacity').value) / 100
|
||||
mainContext.drawImage(watermarkCanvas, 0, 0, cardWidth, cardHeight)
|
||||
mainContext.globalAlpha = 1
|
||||
mainContext.drawImage(manaCostCanvas, 0, 0, cardWidth, cardHeight)
|
||||
} else {
|
||||
mainContext.globalAlpha = 1
|
||||
}
|
||||
mainContext.drawImage(this.whatToDraw, scaleX(this.x), scaleY(this.y), scaleX(this.width) * this.zoom, scaleY(this.height) * this.zoom)
|
||||
}
|
||||
cardMasterElement() {
|
||||
var temporaryElement = document.createElement('div')
|
||||
@@ -204,9 +217,6 @@ function drawCardObjects() {
|
||||
}
|
||||
}
|
||||
}
|
||||
mainContext.globalAlpha = parseInt(document.getElementById('inputWatermarkOpacity').value) / 100
|
||||
mainContext.drawImage(watermarkCanvas, 0, 0, cardWidth, cardHeight)
|
||||
mainContext.globalAlpha = 1
|
||||
mainContext.drawImage(setSymbol, setSymbolDrawX, setSymbolDrawY, setSymbolDrawWidth, setSymbolDrawHeight)
|
||||
mainContext.drawImage(bottomInfoCanvas, 0, 0, cardWidth, cardHeight)
|
||||
mainContext.globalCompositeOperation = 'destination-over'
|
||||
@@ -227,7 +237,7 @@ function drawCardObjects() {
|
||||
}
|
||||
|
||||
class frameImage {
|
||||
constructor(displayName = 'custom', imageSource = '', x = 0, y = 0, width = 1, height = 1, masks = [], frameImageListIndex) {
|
||||
constructor(displayName = 'custom', imageSource = '', x = 0, y = 0, width = 1, height = 1, masks = [], frameImageListIndex, frameClass) {
|
||||
this.name = displayName
|
||||
this.image = new Image()
|
||||
if (this.name == 'custom') {
|
||||
@@ -241,6 +251,7 @@ class frameImage {
|
||||
this.masks = masks
|
||||
this.framePickerElement = document.createElement('div')
|
||||
this.framePickerElement.id = 'frameIndex' + frameImageListIndex
|
||||
this.framePickerElement.classList.add(frameClass)
|
||||
this.framePickerElement.onclick = this.frameOptionClicked
|
||||
this.framePickerElement.innerHTML = '<img src=' + this.image.src + '>'
|
||||
document.getElementById('framePicker').appendChild(this.framePickerElement)
|
||||
@@ -276,12 +287,12 @@ function loadMaskImages(listOfMasks) {
|
||||
maskNameList.push(listOfMasks[i][0])
|
||||
}
|
||||
}
|
||||
function loadFrameImages(listOfFrames) {
|
||||
function loadFrameImages(listOfFrames, frameClass) {
|
||||
for (var i = 0; i < listOfFrames.length; i++) {
|
||||
frameImageList.push(new frameImage(...listOfFrames[i], frameImageList.length))
|
||||
frameImageList.push(new frameImage(...listOfFrames[i], frameImageList.length, frameClass))
|
||||
if (i == 0) {
|
||||
frameObjectToAdd = frameImageList[frameImageList.length - 1]
|
||||
var frameToInsert = cardMasterList.push(new cardImage(frameObjectToAdd.name, frameObjectToAdd.image.src, frameObjectToAdd.x, frameObjectToAdd.y, frameObjectToAdd.width, frameObjectToAdd.height, 1, [], false))
|
||||
var frameToInsert = cardMasterList.push(new cardImage(frameObjectToAdd.name, frameObjectToAdd.image.src, frameObjectToAdd.x, frameObjectToAdd.y, frameObjectToAdd.width, frameObjectToAdd.height, 1, ['Full'], false))
|
||||
cardMaster.insertBefore(cardMasterList[frameToInsert - 1].cardMasterElement(), cardMaster.children[1])
|
||||
frameObjectToAdd.image.onload = function() {
|
||||
drawCardObjects()
|
||||
@@ -323,6 +334,7 @@ function getFloat(input) {
|
||||
}
|
||||
|
||||
function loadTextOptions(textArray) {
|
||||
document.getElementById('textPicker').innerHTML = ''
|
||||
cardTextList = textArray
|
||||
cardTextList.forEach((item, index) => document.getElementById('textPicker').innerHTML += '<div id="' + index + '" onclick="textOptionClicked(event, ' + index + ')">' + item.name + '</div>')
|
||||
document.getElementById('textPicker').children[0].click()
|
||||
@@ -558,29 +570,12 @@ function inputCardArtNameNumber(cardArtNameNumberInput) {
|
||||
function initialize() {
|
||||
//Card stuff
|
||||
cardMasterList.push(new cardPlaceholder('Card Art Placeholder', cardArt))
|
||||
cardMasterList.push(new cardPlaceholder('Text Placeholder', window['textCanvas']))
|
||||
cardMasterList.push(new cardPlaceholder('Text Placeholder', textCanvas))
|
||||
cardMaster.insertBefore(cardMasterList[0].cardMasterElement(), cardMaster.children[0])
|
||||
cardMaster.insertBefore(cardMasterList[1].cardMasterElement(), cardMaster.children[0])
|
||||
document.getElementById('inputInfoNumber').value = date.getFullYear()
|
||||
window.updateTextDelay = setTimeout(drawCardTextReal, 250)
|
||||
setTimeout(bottomInfoUpdated, 500)
|
||||
//CSS & HTML stuff
|
||||
window.layerElements = document.querySelectorAll('.layer')
|
||||
window.addEventListener('resize', windowResized)
|
||||
window.addEventListener('scroll', windowScrolled)
|
||||
windowResized()
|
||||
}
|
||||
|
||||
function windowResized() {
|
||||
window.windowHeight = window.innerHeight
|
||||
}
|
||||
function windowScrolled() {
|
||||
for (var i = 0; i < layerElements.length; i++) {
|
||||
var positionFromTop = (layerElements[i].getBoundingClientRect().top + layerElements[i].getBoundingClientRect().bottom) / 2
|
||||
if (positionFromTop - windowHeight <= 0) {
|
||||
layerElements[i].classList.add('revealedLayer')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function bottomInfoUpdated() {
|
||||
@@ -597,7 +592,7 @@ function uploadLocalFrameImage(event) {
|
||||
}
|
||||
|
||||
function addUploadedFrameImage(imageSource) {
|
||||
frameImageList.push(new frameImage('custom', imageSource, 0, 0, 1, 1, maskNameList, frameImageList.length))
|
||||
frameImageList.push(new frameImage('custom', imageSource, 0, 0, 1, 1, maskNameList, frameImageList.length, 'frameClassCustom'))
|
||||
}
|
||||
|
||||
function manaCostUpdated() {
|
||||
@@ -686,7 +681,6 @@ function inputCardNameNumberTextImport(index) {
|
||||
importText(beforeAfter(importCardTextResponse, '"type_line":"', '",'), 'Card Type')
|
||||
importText(beforeAfter(importCardTextResponse, '"oracle_text":"', '",').replace(/\\n/g, '\n').replace(/ \\"/g, ' \u201C').replace(/\\"/g, '\u201D').replace(/\(/g, '{i}(').replace(/\)/g, '){/i}'), 'Rules Text')
|
||||
if (importCardTextResponse.includes('"power":"')) {
|
||||
console.log('hmmm')
|
||||
importText(beforeAfter(importCardTextResponse, '"power":"', '",') + '/' + beforeAfter(importCardTextResponse, '"toughness":"', '",'), 'Power/Toughness')
|
||||
} else {
|
||||
importText('', 'Power Toughness')
|
||||
@@ -727,7 +721,7 @@ function inputCardNameNumberTextImport(index) {
|
||||
document.getElementById('inputCardArtName').value = beforeAfter(importCardTextResponse, '"name":"', '",')
|
||||
document.getElementById('inputSetCode').value = beforeAfter(importCardTextResponse, '"set":"', '",')
|
||||
document.getElementById('inputSetRarity').value = beforeAfter(importCardTextResponse, '"rarity":"', '",')[0]
|
||||
setSymbol.src = 'https://cors-anywhere.herokuapp.com/http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=' + document.getElementById('inputSetCode').value + '&size=large&rarity=' + document.getElementById('inputSetRarity').value
|
||||
autoCrop(setSymbol, 'https://cors-anywhere.herokuapp.com/http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=' + document.getElementById('inputSetCode').value + '&size=large&rarity=' + document.getElementById('inputSetRarity').value)
|
||||
inputCardArtName(beforeAfter(importCardTextResponse, '"name":"', '",'))
|
||||
manaCostUpdated()
|
||||
drawCardText()
|
||||
@@ -782,9 +776,69 @@ function loadScript(scriptPath){
|
||||
}
|
||||
}
|
||||
|
||||
function hideFrameImages(frameClass) {
|
||||
Array.from(document.getElementById('framePicker').children).forEach(element => {
|
||||
if (!element.classList.contains(frameClass)) {
|
||||
element.classList.add('hidden')
|
||||
} else {
|
||||
element.classList.remove('hidden')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
function autoCrop(targetImage, source = targetImage.src) {
|
||||
var autoCropImage = new Image()
|
||||
autoCropImage.crossOrigin = 'anonymous'
|
||||
autoCropImage.src = source
|
||||
autoCropImage.onload = function() {
|
||||
var width = this.width
|
||||
var height = this.height
|
||||
autoCropCanvas.width = width
|
||||
autoCropCanvas.height = height
|
||||
autoCropContext.drawImage(this, 0, 0,)
|
||||
var pixels = {x:[], y:[]}
|
||||
var imageData = autoCropContext.getImageData(0, 0, width, height)
|
||||
var x, y, index
|
||||
if (imageData.data.length > 4) {
|
||||
for (y = 0; y < height; y++) { //scans from left to right, top to bottom
|
||||
for (x = 0; x < width; x++) {
|
||||
index = (y * width + x) * 4 + 3 //calculuates the alpha value index
|
||||
if (imageData.data[index] > 0) {
|
||||
pixels.x.push(x)
|
||||
pixels.y.push(y) //stores visible pixel coordinates
|
||||
}
|
||||
}
|
||||
}
|
||||
pixels.x.sort(function(a, b){return a - b})
|
||||
pixels.y.sort(function(a, b){return a - b})
|
||||
var n = pixels.x.length - 1
|
||||
width = pixels.x[n] - pixels.x[0]
|
||||
height = pixels.y[n] - pixels.y[0]
|
||||
var cropped = autoCropContext.getImageData(pixels.x[0], pixels.y[0], width + 1, height + 1)
|
||||
autoCropCanvas.width = width + 1
|
||||
autoCropCanvas.height = height + 1
|
||||
autoCropContext.putImageData(cropped, 0, 0)
|
||||
setTimeout(function(){targetImage.src = autoCropCanvas.toDataURL()}, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
var n = pix.x.length - 1;
|
||||
//Finds the difference between the leftmost and rightmost visible pixels, and the topmost and bottommost pixels, cuts out a section of the canvas
|
||||
width = pix.x[n] - pix.x[0];
|
||||
height = pix.y[n] - pix.y[0];
|
||||
var cropped = cropContext.getImageData(pix.x[0], pix.y[0], width + 1, height + 1);
|
||||
//Resizes the canvas and draws cropped image
|
||||
cropCanvas.width = width + 1;
|
||||
cropCanvas.height = height + 1;
|
||||
cropContext.putImageData(cropped, 0, 0);
|
||||
//Saves the newly cropped image to the given image
|
||||
setTimeout(function() {targetImage.src = cropCanvas.toDataURL();}, 100)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
@@ -23,59 +23,54 @@ var versionM15ImageList = [
|
||||
['Multicolored Legend Crown', 'data/images/m15/m15CrownM.png', 38/1500, 29/2100, 1422/1500, 341/2100, ['Full']],
|
||||
['Artifact Legend Crown', 'data/images/m15/m15CrownA.png', 38/1500, 29/2100, 1422/1500, 341/2100, ['Full']],
|
||||
['Land Legend Crown', 'data/images/m15/m15CrownL.png', 38/1500, 29/2100, 1422/1500, 341/2100, ['Full']],
|
||||
['Midnight Frame', 'data/images/m15/m15Midnight.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['White Nyx Nyx Frame', 'data/images/m15/m15FrameWNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Blue Nyx Frame', 'data/images/m15/m15FrameUNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Black Nyx Frame', 'data/images/m15/m15FrameBNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Red Nyx Frame', 'data/images/m15/m15FrameRNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Green Nyx Frame', 'data/images/m15/m15FrameGNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Multicolored Nyx Frame', 'data/images/m15/m15FrameMNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Artifact Nyx Frame', 'data/images/m15/m15FrameANyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['White Nyx Legend Crown', 'data/images/m15/m15CrownWNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Blue Nyx Legend Crown', 'data/images/m15/m15CrownUNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Black Nyx Legend Crown', 'data/images/m15/m15CrownBNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Red Nyx Legend Crown', 'data/images/m15/m15CrownRNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Green Nyx Legend Crown', 'data/images/m15/m15CrownGNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Multicolored Nyx Legend Crown', 'data/images/m15/m15CrownMNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']]
|
||||
['Midnight Frame', 'data/images/m15/m15Midnight.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']]
|
||||
]
|
||||
|
||||
var versionM15MaskList = [['Right Half', 'data/images/maskRightHalf.png'], ['Pinline (m15)', 'data/images/m15/m15MaskPinline.png'], ['Full', 'data/images/maskFull.png'], ['Border (m15)', 'data/images/m15/m15MaskBorder.png'], ['Title (m15)', 'data/images/m15/m15MaskTitle.png'], ['Type (m15)', 'data/images/m15/m15MaskType.png'], ['Rules (m15)', 'data/images/m15/m15MaskRules.png'], ['Frame (m15)', 'data/images/m15/m15MaskFrame.png'], ['Nyx Crown (m15)', 'data/images/m15/m15MaskNyxCrown.png'], ['Nyx Crown Outer (m15)', 'data/images/m15/m15MaskNyxCrownOuter.png'], ['Nyx Crown Inner (m15)', 'data/images/m15/m15MaskNyxCrownInner.png'], ['Nyx Crown Shadowless (m15)', 'data/images/m15/m15MaskNyxCrownShadowless.png']]
|
||||
var versionM15MaskList = [['Full', 'data/images/maskFull.png'], ['Border (m15)', 'data/images/m15/m15MaskBorder.png'], ['Right Half', 'data/images/maskRightHalf.png'], ['Pinline (m15)', 'data/images/m15/m15MaskPinline.png'], ['Title (m15)', 'data/images/m15/m15MaskTitle.png'], ['Type (m15)', 'data/images/m15/m15MaskType.png'], ['Rules (m15)', 'data/images/m15/m15MaskRules.png'], ['Frame (m15)', 'data/images/m15/m15MaskFrame.png']]
|
||||
|
||||
if (!loadedVersions.includes('m15')) {
|
||||
loadedVersions.push("m15")
|
||||
loadedVersions.push('m15')
|
||||
loadMaskImages(versionM15MaskList)
|
||||
loadFrameImages(versionM15ImageList)
|
||||
loadFrameImages(versionM15ImageList, 'frameClassM15')
|
||||
}
|
||||
|
||||
loadTextOptions([
|
||||
new cardText('Card Title', '', 126/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Card Type', '', 126/1500, 1263/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Rules Text', '', 135/1500, 1372/2100, 1230/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"'])
|
||||
])
|
||||
if (currentVersion != 'm15') {
|
||||
currentVersion = 'm15'
|
||||
|
||||
artX = scaleX(111 / 1500)
|
||||
artY = scaleY(233 / 2100)
|
||||
artWidth = scaleX(1278 / 1500)
|
||||
artHeight = scaleY(936 / 2100)
|
||||
hideFrameImages('frameClassM15')
|
||||
|
||||
bottomInfoFunction = 'bottomInfoM15'
|
||||
loadTextOptions([
|
||||
new cardText('Card Title', '', 126/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Card Type', '', 126/1500, 1263/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Rules Text', '', 135/1500, 1372/2100, 1230/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"'])
|
||||
])
|
||||
|
||||
manaCostXPath = '1316 - 78 * manaSymbolIndex'
|
||||
manaCostYPath = '121'
|
||||
manaCostDiameter = '70'
|
||||
manaCostShadowOffset = '[-2, 6]'
|
||||
manaCostDirection = 'reverse'
|
||||
artX = scaleX(111 / 1500)
|
||||
artY = scaleY(233 / 2100)
|
||||
artWidth = scaleX(1278 / 1500)
|
||||
artHeight = scaleY(936 / 2100)
|
||||
|
||||
setSymbolX = [scaleX(1382/1500), 'right']
|
||||
setSymbolY = [scaleY(1200/2100), 'left']
|
||||
setSymbolWidth = scaleX(180/1500)
|
||||
setSymbolHeight = scaleY(80/2100)
|
||||
manaCostXPath = '1316 - 78 * manaSymbolIndex'
|
||||
manaCostYPath = '121'
|
||||
manaCostDiameter = '70'
|
||||
manaCostShadowOffset = '[-2, 6]'
|
||||
manaCostDirection = 'reverse'
|
||||
|
||||
watermarkX = scaleX(0.5)
|
||||
watermarkY = scaleY(1630/2100)
|
||||
watermarkWidth = scaleX(1140/1500)
|
||||
watermarkHeight = scaleY(484/2100)
|
||||
setSymbolX = [scaleX(1382/1500), 'right']
|
||||
setSymbolY = [scaleY(1240/2100), 'center']
|
||||
setSymbolWidth = scaleX(180/1500)
|
||||
setSymbolHeight = scaleY(80/2100)
|
||||
|
||||
watermarkX = scaleX(0.5)
|
||||
watermarkY = scaleY(1630/2100)
|
||||
watermarkWidth = scaleX(1140/1500)
|
||||
watermarkHeight = scaleY(484/2100)
|
||||
|
||||
bottomInfoFunction = 'bottomInfoM15'
|
||||
|
||||
bottomInfoUpdated()
|
||||
}
|
||||
|
||||
function bottomInfoM15() {
|
||||
bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight)
|
||||
@@ -83,8 +78,6 @@ function bottomInfoM15() {
|
||||
for (var i = 0; i < cardTextList.length; i++) {
|
||||
if (cardTextList[i].name == 'Power/Toughness' && cardTextList[i].text != '') {
|
||||
ptBoxShift = 36/2100
|
||||
} else {
|
||||
// console.log(cardTextList[i].name, cardTextList[i].text)
|
||||
}
|
||||
}
|
||||
writeText(
|
||||
@@ -95,6 +88,4 @@ function bottomInfoM15() {
|
||||
{text: '*Not for Sale*', x: 97/1500, y: 2056/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '{right}CardConjurer.com', x: 97/1500, y: 2020/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}
|
||||
], bottomInfoContext)
|
||||
}
|
||||
|
||||
bottomInfoUpdated()
|
||||
}
|
61
data/scripts/versionM15Nyx.js
Normal file
61
data/scripts/versionM15Nyx.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var versionM15NyxImageList = [
|
||||
['White Nyx Nyx Frame', 'data/images/m15/m15FrameWNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Blue Nyx Frame', 'data/images/m15/m15FrameUNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Black Nyx Frame', 'data/images/m15/m15FrameBNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Red Nyx Frame', 'data/images/m15/m15FrameRNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Green Nyx Frame', 'data/images/m15/m15FrameGNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Multicolored Nyx Frame', 'data/images/m15/m15FrameMNyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['Artifact Nyx Frame', 'data/images/m15/m15FrameANyx.png', 0, 0, 1, 1, ['Full', 'Pinline (m15)', 'Title (m15)', 'Type (m15)', 'Rules (m15)', 'Frame (m15)', 'Border (m15)']],
|
||||
['White Nyx Legend Crown', 'data/images/m15/m15CrownWNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Blue Nyx Legend Crown', 'data/images/m15/m15CrownUNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Black Nyx Legend Crown', 'data/images/m15/m15CrownBNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Red Nyx Legend Crown', 'data/images/m15/m15CrownRNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Green Nyx Legend Crown', 'data/images/m15/m15CrownGNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']],
|
||||
['Multicolored Nyx Legend Crown', 'data/images/m15/m15CrownMNyx.png', 39/1500, 29/2100, 1422/1500, 341/2100, ['Full', 'Nyx Crown (m15)', 'Nyx Crown Outer (m15)', 'Nyx Crown Inner (m15)', 'Nyx Crown Shadowless (m15)']]
|
||||
]
|
||||
|
||||
var versionM15NyxMaskList = [['Nyx Crown (m15)', 'data/images/m15/m15MaskNyxCrown.png'], ['Nyx Crown Outer (m15)', 'data/images/m15/m15MaskNyxCrownOuter.png'], ['Nyx Crown Inner (m15)', 'data/images/m15/m15MaskNyxCrownInner.png'], ['Nyx Crown Shadowless (m15)', 'data/images/m15/m15MaskNyxCrownShadowless.png']]
|
||||
|
||||
if (!loadedVersions.includes('m15Nyx')) {
|
||||
loadedVersions.push("m15Nyx")
|
||||
loadMaskImages(versionM15NyxMaskList)
|
||||
loadFrameImages(versionM15NyxImageList, 'frameClassM15')
|
||||
}
|
||||
|
||||
if (currentVersion != 'm15') {
|
||||
currentVersion = 'm15'
|
||||
|
||||
hideFrameImages('frameClassM15')
|
||||
|
||||
loadTextOptions([
|
||||
new cardText('Card Title', '', 126/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Card Type', '', 126/1500, 1263/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Rules Text', '', 135/1500, 1372/2100, 1230/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"'])
|
||||
])
|
||||
|
||||
artX = scaleX(111 / 1500)
|
||||
artY = scaleY(233 / 2100)
|
||||
artWidth = scaleX(1278 / 1500)
|
||||
artHeight = scaleY(936 / 2100)
|
||||
|
||||
manaCostXPath = '1316 - 78 * manaSymbolIndex'
|
||||
manaCostYPath = '121'
|
||||
manaCostDiameter = '70'
|
||||
manaCostShadowOffset = '[-2, 6]'
|
||||
manaCostDirection = 'reverse'
|
||||
|
||||
setSymbolX = [scaleX(1382/1500), 'right']
|
||||
setSymbolY = [scaleY(1200/2100), 'center']
|
||||
setSymbolWidth = scaleX(180/1500)
|
||||
setSymbolHeight = scaleY(80/2100)
|
||||
|
||||
watermarkX = scaleX(0.5)
|
||||
watermarkY = scaleY(1630/2100)
|
||||
watermarkWidth = scaleX(1140/1500)
|
||||
watermarkHeight = scaleY(484/2100)
|
||||
|
||||
bottomInfoFunction = 'bottomInfoM15'
|
||||
|
||||
bottomInfoUpdated()
|
||||
}
|
232
data/scripts/versionPlaneswalker.js
Normal file
232
data/scripts/versionPlaneswalker.js
Normal file
@@ -0,0 +1,232 @@
|
||||
var versionPlaneswalkerImageList = [
|
||||
['White Frame', 'data/images/planeswalker/planeswalkerFrameW.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Blue Frame', 'data/images/planeswalker/planeswalkerFrameU.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Black Frame', 'data/images/planeswalker/planeswalkerFrameB.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Red Frame', 'data/images/planeswalker/planeswalkerFrameR.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Green Frame', 'data/images/planeswalker/planeswalkerFrameG.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Multicolored Frame', 'data/images/planeswalker/planeswalkerFrameM.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Artifact Frame', 'data/images/planeswalker/planeswalkerFrameA.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Colorless Frame', 'data/images/planeswalker/planeswalkerFrameC.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']],
|
||||
['Dark Twins', 'data/images/planeswalker/planeswalkerDarkTwins.png', 0, 0, 1, 1, ['Full', 'Pinline (planeswalker)', 'Title (planeswalker)', 'Type (planeswalker)', 'Frame (planeswalker)', 'Border (planeswalker)']]
|
||||
]
|
||||
|
||||
var versionPlaneswalkerMaskList = [['Pinline (planeswalker)', 'data/images/planeswalker/planeswalkerMaskPinline.png'], ['Border (planeswalker)', 'data/images/planeswalker/planeswalkerMaskBorder.png'], ['Title (planeswalker)', 'data/images/planeswalker/planeswalkerMaskTitle.png'], ['Type (planeswalker)', 'data/images/planeswalker/planeswalkerMaskType.png'], ['Frame (planeswalker)', 'data/images/planeswalker/planeswalkerMaskFrame.png'], ['Rules Text (planeswalker)', 'data/images/planeswalker/planeswalkerMaskText.png']]
|
||||
|
||||
if (!loadedVersions.includes('planeswalker')) {
|
||||
loadedVersions.push('planeswalker')
|
||||
newCanvas('planeswalker')
|
||||
loadMaskImages(versionPlaneswalkerMaskList)
|
||||
loadFrameImages(versionPlaneswalkerImageList, 'frameClassPlaneswalker')
|
||||
|
||||
document.getElementById('tabPicker').innerHTML += `<div onclick='toggleTabs(this, "planeswalkerTab")'>Planeswalker</div>`
|
||||
var planeswalkerTab = document.createElement("div")
|
||||
planeswalkerTab.classList.add('hidden')
|
||||
planeswalkerTab.id = 'planeswalkerTab'
|
||||
planeswalkerTab.innerHTML = `
|
||||
One: <input type="number" class="input number" id="inputPlaneswalker1" oninput="planeswalkerAbilities()" value="200" min="0"><input type="text" class="input text" id="inputPlaneswalker1Icon" oninput="planeswalkerAbilities()" value="+1">
|
||||
Two: <input type="number" class="input number" id="inputPlaneswalker2" oninput="planeswalkerAbilities()" value="200" min="0"><input type="text" class="input text" id="inputPlaneswalker2Icon" oninput="planeswalkerAbilities()" value="0">
|
||||
Three: <input type="number" class="input number" id="inputPlaneswalker3" oninput="planeswalkerAbilities()" value="200" min="0"><input type="text" class="input text" id="inputPlaneswalker3Icon" oninput="planeswalkerAbilities()" value="-3">
|
||||
Four: <input type="number" class="input number" id="inputPlaneswalker4" oninput="planeswalkerAbilities()" value="0" min="0" max="1039"><input type="text" class="input text" id="inputPlaneswalker4Icon" oninput="planeswalkerAbilities()" value="-9"><br>
|
||||
For two-ability Planeswalkers only:<br>
|
||||
<input type="checkbox" onchange="changePlaneswalkerAbilityLayout()" id="inputWARSpacing"> Use War of the Spark ability spacing<br>
|
||||
<input type="checkbox" onchange="changePlaneswalkerAbilityLayout()" id="inputWARReverse"> Reverse War of the Spark ability spacing<br>
|
||||
<input type="checkbox" onchange="invertPlaneswalkerColors()" id="inputColorInvert"> Dark ability boxes`
|
||||
document.getElementById('tabOptions').appendChild(planeswalkerTab)
|
||||
var planeswalkerPlus = new Image()
|
||||
planeswalkerPlus.crossOrigin = 'anonymous'
|
||||
planeswalkerPlus.src = 'data/images/planeswalker/planeswalkerPlus.png'
|
||||
var planeswalkerNeutral = new Image()
|
||||
planeswalkerNeutral.crossOrigin = "anonymous"
|
||||
planeswalkerNeutral.src = 'data/images/planeswalker/planeswalkerNeutral.png'
|
||||
var planeswalkerMinus = new Image()
|
||||
planeswalkerMinus.crossOrigin = "anonymous"
|
||||
planeswalkerMinus.src = 'data/images/planeswalker/planeswalkerMinus.png'
|
||||
var lightToDarkPlaneswalker = new Image()
|
||||
lightToDarkPlaneswalker.crossOrigin = 'anonymous'
|
||||
lightToDarkPlaneswalker.src = 'data/images/planeswalker/abilityLineOdd.png'
|
||||
var darkToLightPlaneswalker = new Image()
|
||||
darkToLightPlaneswalker.crossOrigin = 'anonymous'
|
||||
darkToLightPlaneswalker.src = 'data/images/planeswalker/abilityLineEven.png'
|
||||
var lightToDarkPlaneswalkerDarkened= new Image()
|
||||
lightToDarkPlaneswalkerDarkened.crossOrigin = 'anonymous'
|
||||
lightToDarkPlaneswalkerDarkened.src = 'data/images/planeswalker/abilityLineOddDarkened.png'
|
||||
var darkToLightPlaneswalkerDarkened = new Image()
|
||||
darkToLightPlaneswalkerDarkened.crossOrigin = 'anonymous'
|
||||
darkToLightPlaneswalkerDarkened.onload = function() {invertPlaneswalkerColors()}
|
||||
darkToLightPlaneswalkerDarkened.src = 'data/images/planeswalker/abilityLineEvenDarkened.png'
|
||||
setTimeout(planeswalkerAbilities, 1000)
|
||||
//placeholders:
|
||||
var darkColor = '#a4a4a4'
|
||||
var lightColor = 'white'
|
||||
var planeswalkerLightToDark = new Image()
|
||||
var planeswalkerDarkToLight = new Image()
|
||||
}
|
||||
|
||||
if (currentVersion != 'planeswalker') {
|
||||
currentVersion = 'planeswalker'
|
||||
|
||||
hideFrameImages('frameClassPlaneswalker')
|
||||
|
||||
loadTextOptions([
|
||||
new cardText('Card Title', '', 130/1500, 149/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Card Type', '', 130/1500, 1258/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Ability 1', '', 270/1500, 1153/2100, 1120/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Ability 2', '', 270/1500, 1153/2100, 1120/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Ability 3', '', 270/1500, 1153/2100, 1120/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Ability 4', '', 270/1500, 1153/2100, 1120/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Loyalty', '', 1215/1500, 1954/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'white', ['oneLine=true,textAlign="center"'])
|
||||
])
|
||||
|
||||
artX = scaleX(100 / 1500)
|
||||
artY = scaleY(190 / 2100)
|
||||
artWidth = scaleX(1508 / 1500)
|
||||
artHeight = scaleY(1730 / 2100)
|
||||
|
||||
manaCostXPath = '1316 - 78 * manaSymbolIndex'
|
||||
manaCostYPath = '86'
|
||||
manaCostDiameter = '70'
|
||||
manaCostShadowOffset = '[-2, 6]'
|
||||
manaCostDirection = 'reverse'
|
||||
|
||||
setSymbolX = [scaleX(1383/1500), 'right']
|
||||
setSymbolY = [scaleY(1237/2100), 'center']
|
||||
setSymbolWidth = scaleX(180/1500)
|
||||
setSymbolHeight = scaleY(80/2100)
|
||||
|
||||
watermarkX = scaleX(0.5)
|
||||
watermarkY = scaleY(1630/2100)
|
||||
watermarkWidth = scaleX(1140/1500)
|
||||
watermarkHeight = scaleY(484/2100)
|
||||
|
||||
bottomInfoFunction = 'bottomInfoPlaneswalker'
|
||||
|
||||
bottomInfoUpdated()
|
||||
}
|
||||
|
||||
function bottomInfoPlaneswalker() {
|
||||
bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight)
|
||||
var ptBoxShift = 36/2100
|
||||
writeText(
|
||||
[
|
||||
{text: document.getElementById('inputInfoNumber').value, x: 97/1500, y: 1990/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {artistbrush}{up' + scaleY(36/2100) + '}' + document.getElementById('inputInfoRarity').value + ' {down' + scaleY(72/2100) + '}{up' + scaleY(36/2100) + '}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2026/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 1990/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '*Not for Sale*', x: 97/1500, y: 2056/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '{right}CardConjurer.com', x: 97/1500, y: 2020/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}
|
||||
], bottomInfoContext)
|
||||
}
|
||||
|
||||
var planeswalkerAbilityLayout = [[0], [0, scaleY(784/1050)], [0, scaleY(730/1050), scaleY(863/1050)], [0, scaleY(697/1050), scaleY(784/1050), scaleY(878/1050)], [0, scaleY(683/1050), scaleY(756/1050), scaleY(830/1050), scaleY(904/1050)]]
|
||||
var planeswalkerAbilityCount = 3
|
||||
var ability1Y = 0, ability2Y = 0, ability3Y = 0, ability4Y = 0, ability5Y = cardHeight
|
||||
|
||||
function planeswalkerAbilities() {
|
||||
planeswalkerContext.clearRect(0, 0, cardWidth, cardHeight)
|
||||
planeswalkerAbilityCount = 0
|
||||
for (var i = 1; i < 5; i++) {
|
||||
cardTextList[i + 1].y = 2
|
||||
if (getFloat('inputPlaneswalker' + i) != 0) {
|
||||
planeswalkerAbilityCount += 1;
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (planeswalkerAbilityCount > 0) {
|
||||
ability1Y = scaleY(648/1050)
|
||||
if (planeswalkerAbilityCount > 1) {
|
||||
window.ability2Y = getFloat("inputPlaneswalker1") + ability1Y
|
||||
if (planeswalkerAbilityCount > 2) {
|
||||
ability3Y = getFloat('inputPlaneswalker2') + ability2Y
|
||||
if (planeswalkerAbilityCount > 3) {
|
||||
ability4Y = getFloat('inputPlaneswalker3') + ability3Y
|
||||
// planeswalkerContext.writeText(version.textList[5][1], scale(133), ability4Y + (scale(950) - ability4Y) / 2, scale(555), 0, "mplantin", scale(38), "black", "lineSpace=0.97");
|
||||
cardTextList[5].y = (ability4Y) / cardHeight + cardTextList[5].fontSize - 10/2100
|
||||
cardTextList[5].height = getFloat('inputPlaneswalker4') / cardHeight
|
||||
}
|
||||
// planeswalkerContext.writeText(version.textList[4][1], scale(133), ability3Y + getValue("inputPlaneswalker3") / 2, scale(555), 0, "mplantin", scale(38), "black", "lineSpace=0.97");
|
||||
cardTextList[4].y = (ability3Y) / cardHeight + cardTextList[4].fontSize - 10/2100
|
||||
cardTextList[4].height = getFloat('inputPlaneswalker3') / cardHeight
|
||||
}
|
||||
// planeswalkerContext.writeText(version.textList[3][1], scale(133), ability2Y + getValue("inputPlaneswalker2") / 2, scale(555), 0, "mplantin", scale(38), "black", "lineSpace=0.97");
|
||||
cardTextList[3].y = (ability2Y) / cardHeight + cardTextList[3].fontSize - 10/2100
|
||||
cardTextList[3].height = getFloat('inputPlaneswalker2') / cardHeight
|
||||
}
|
||||
// planeswalkerContext.writeText(version.textList[2][1], scale(133), ability1Y + getValue("inputPlaneswalker1") / 2, scale(555), 0, "mplantin", scale(38), "black", "lineSpace=0.97", "planeswalkerTextFunction");
|
||||
cardTextList[2].y = (ability1Y) / cardHeight + cardTextList[2].fontSize - 10/2100
|
||||
cardTextList[2].height = getFloat('inputPlaneswalker1') / cardHeight
|
||||
planeswalkerTextFunction()
|
||||
}
|
||||
}
|
||||
function planeswalkerTextFunction() {
|
||||
planeswalkerContext.globalCompositeOperation = 'destination-over'
|
||||
var lastAdjust = 0
|
||||
var textBoxWidth = scaleX(1210/1500)
|
||||
for (var i = 1; i < planeswalkerAbilityCount + 1; i++) {
|
||||
if (i == planeswalkerAbilityCount) {
|
||||
lastAdjust = 2 * cardHeight
|
||||
}
|
||||
if (i % 2 == 1) {
|
||||
planeswalkerContext.fillStyle = lightColor
|
||||
planeswalkerContext.globalAlpha = 0.608
|
||||
planeswalkerContext.fillRect(scaleX(91/750), window['ability' + i + 'Y'] + scaleY(10/1050), textBoxWidth, window['ability' + (i + 1) + 'Y'] - window['ability' + i + 'Y'] - scaleY(20/1050) + lastAdjust)
|
||||
if (i == 1 && planeswalkerAbilityCount != 1) {
|
||||
planeswalkerContext.fillRect(scaleX(91/750), window['ability' + i + 'Y'], textBoxWidth, scaleY(10/1050))
|
||||
}
|
||||
planeswalkerContext.globalAlpha = 1
|
||||
planeswalkerContext.drawImage(planeswalkerLightToDark, scaleX(91/750), window['ability' + (i + 1) + 'Y'] - scaleY(10/1050) + lastAdjust, textBoxWidth, scaleY(20/1050))
|
||||
} else {
|
||||
planeswalkerContext.fillStyle = darkColor
|
||||
planeswalkerContext.globalAlpha = 0.706
|
||||
planeswalkerContext.fillRect(scaleX(91/750), window['ability' + i + 'Y'] + scaleY(10/1050), textBoxWidth, window['ability' + (i + 1) + 'Y'] - window['ability' + i + 'Y'] - scaleY(20/1050) + lastAdjust)
|
||||
planeswalkerContext.globalAlpha = 1
|
||||
planeswalkerContext.drawImage(planeswalkerDarkToLight, scaleX(91/750), window['ability' + (i + 1)+ 'Y'] - scaleY(10/1050) + lastAdjust, textBoxWidth, scaleY(20/1050))
|
||||
}
|
||||
}
|
||||
planeswalkerContext.globalCompositeOperation = 'destination-in'
|
||||
planeswalkerContext.drawImage(maskImageList[maskNameList.indexOf('Rules Text (planeswalker)')], 0, 0, cardWidth, cardHeight)
|
||||
planeswalkerContext.globalCompositeOperation = 'source-over'
|
||||
planeswalkerContext.fillStyle = 'white'
|
||||
planeswalkerContext.font = scaleY(30/1050) + 'px belerenbsc'
|
||||
planeswalkerContext.textAlign = 'center'
|
||||
for (var i = 1; i < planeswalkerAbilityCount + 1; i++) {
|
||||
var planeswalkerIconValue = document.getElementById('inputPlaneswalker' + i + 'Icon').value
|
||||
var planeswalkerMidpoint = getFloat('inputPlaneswalker' + i + '') / 2 + window['ability' + i + 'Y']
|
||||
if (planeswalkerIconValue.includes('+')) {
|
||||
planeswalkerContext.drawImage(planeswalkerPlus, scaleX(22/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] - scaleY(27/1050), scaleX(105/750), scaleY(76/1050))
|
||||
planeswalkerContext.fillText(planeswalkerIconValue, scaleX(77/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] + scaleY(18/1050))
|
||||
} else if (planeswalkerIconValue.includes('-')) {
|
||||
planeswalkerContext.drawImage(planeswalkerMinus, scaleX(21/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] - scaleY(16/1050), scaleX(106/750), scaleY(74/1050))
|
||||
planeswalkerContext.fillText(planeswalkerIconValue, scaleX(77/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] + scaleY(19/1050))
|
||||
} else if (planeswalkerIconValue != '') {
|
||||
planeswalkerContext.drawImage(planeswalkerNeutral, scaleX(21/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] - scaleY(16/1050), scaleX(106/750), scaleY(64/1050))
|
||||
planeswalkerContext.fillText(planeswalkerIconValue, scaleX(77/750), planeswalkerAbilityLayout[planeswalkerAbilityCount][i] + scaleY(20/1050))
|
||||
}
|
||||
}
|
||||
cardTextEdited()
|
||||
}
|
||||
function changePlaneswalkerAbilityLayout() {
|
||||
if (document.getElementById('inputWARSpacing').checked) {
|
||||
if (document.getElementById('inputWARReverse').checked) {
|
||||
planeswalkerAbilityLayout[2] = [0, scaleY(784/1050), scaleY(878/1050)]
|
||||
} else {
|
||||
planeswalkerAbilityLayout[2] = [0, scaleY(697/1050), scaleY(784/1050)]
|
||||
}
|
||||
} else {
|
||||
planeswalkerAbilityLayout[2] = [0, scaleY(730/1050), scaleY(863/1050)]
|
||||
}
|
||||
planeswalkerAbilities()
|
||||
}
|
||||
function invertPlaneswalkerColors() {
|
||||
if (document.getElementById('inputColorInvert').checked) {
|
||||
darkColor = '#5b5b5b'
|
||||
lightColor = 'black'
|
||||
planeswalkerLightToDark.src = lightToDarkPlaneswalkerDarkened.src
|
||||
planeswalkerDarkToLight.src = darkToLightPlaneswalkerDarkened.src
|
||||
} else {
|
||||
darkColor = '#a4a4a4'
|
||||
lightColor = 'white'
|
||||
planeswalkerLightToDark.src = lightToDarkPlaneswalker.src
|
||||
planeswalkerDarkToLight.src = darkToLightPlaneswalker.src
|
||||
}
|
||||
planeswalkerAbilities();
|
||||
}
|
73
data/scripts/versionStorybook.js
Normal file
73
data/scripts/versionStorybook.js
Normal file
@@ -0,0 +1,73 @@
|
||||
var versionStorybookImageList = [
|
||||
['White Frame', 'data/images/storybook/storybookFrameW.png', 0, 0, 1, 1, ['Full']],
|
||||
['Blue Frame', 'data/images/storybook/storybookFrameU.png', 0, 0, 1, 1, ['Full']],
|
||||
['Black Frame', 'data/images/storybook/storybookFrameB.png', 0, 0, 1, 1, ['Full']],
|
||||
['Red Frame', 'data/images/storybook/storybookFrameR.png', 0, 0, 1, 1, ['Full']],
|
||||
['Green Frame', 'data/images/storybook/storybookFrameG.png', 0, 0, 1, 1, ['Full']],
|
||||
['Colorless Frame', 'data/images/storybook/storybookFrameC.png', 0, 0, 1, 1, ['Full']]
|
||||
]
|
||||
|
||||
var versionStorybookMaskList = [['Storybook Right Half', 'data/images/storybook/maskStorybookRightHalf.png']]
|
||||
|
||||
if (!loadedVersions.includes('storybook')) {
|
||||
loadedVersions.push('storybook')
|
||||
// loadMaskImages(versionStorybookMaskList)
|
||||
loadFrameImages(versionStorybookImageList, 'frameClassStorybook')
|
||||
}
|
||||
|
||||
if (currentVersion != 'storybook') {
|
||||
currentVersion = 'storybook'
|
||||
|
||||
hideFrameImages('frameClassStorybook')
|
||||
|
||||
loadTextOptions([
|
||||
new cardText('Card Title', '', 222/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Card Type', '', 345/1500, 1268/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']),
|
||||
new cardText('Rules Text', '', 124/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Rules Text (Right)', '', 780/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'),
|
||||
new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"'])
|
||||
])
|
||||
|
||||
artX = scaleX(50/1500)
|
||||
artY = scaleY(54/2100)
|
||||
artWidth = scaleX(1405/1500)
|
||||
artHeight = scaleY(1175/2100)
|
||||
|
||||
manaCostXPath = '1316 - 78 * manaSymbolIndex'
|
||||
manaCostYPath = '121'
|
||||
manaCostDiameter = '70'
|
||||
manaCostShadowOffset = '[-2, 6]'
|
||||
manaCostDirection = 'reverse'
|
||||
|
||||
setSymbolX = [scaleX(1328/1500), 'center']
|
||||
setSymbolY = [scaleY(1245/2100), 'center']
|
||||
setSymbolWidth = scaleX(74/1500)
|
||||
setSymbolHeight = scaleY(74/2100)
|
||||
|
||||
watermarkX = scaleX(0.5)
|
||||
watermarkY = scaleY(1630/2100)
|
||||
watermarkWidth = scaleX(1140/1500)
|
||||
watermarkHeight = scaleY(484/2100)
|
||||
|
||||
bottomInfoFunction = 'bottomInfoStorybook'
|
||||
|
||||
bottomInfoUpdated()
|
||||
}
|
||||
|
||||
function bottomInfoStorybook() {
|
||||
bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight)
|
||||
var ptBoxShift = 0
|
||||
for (var i = 0; i < cardTextList.length; i++) {
|
||||
if (cardTextList[i].name == 'Power/Toughness' && cardTextList[i].text != '') {
|
||||
ptBoxShift = 36/2100
|
||||
}
|
||||
}
|
||||
writeText(
|
||||
[
|
||||
{text: document.getElementById('inputInfoNumber').value, x: 97/1500, y: 2000/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {artistbrush}{up' + scaleY(36/2100) + '}' + document.getElementById('inputInfoRarity').value + ' {down' + scaleY(72/2100) + '}{up' + scaleY(36/2100) + '}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2036/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 2000/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '*Not for Sale*', x: 97/1500, y: 2066/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']},
|
||||
{text: '{right}CardConjurer.com', x: 97/1500, y: 2030/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}
|
||||
], bottomInfoContext)
|
||||
}
|
Reference in New Issue
Block a user