Compare commits

...

1 Commits

Author SHA1 Message Date
Vftdan dfc0870fc1 Fixed some inconsistent whitespaces 2024-04-23 01:02:02 +02:00
1 changed files with 66 additions and 66 deletions

View File

@ -91,33 +91,33 @@ function loadParts(parts) {
} }
function fillArrayEyes(item){ function fillArrayEyes(item) {
let name = item.name; let name = item.name;
let url = item.url; let url = item.url;
eyes.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 eyes.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1
} }
function fillArrayBody(item){ function fillArrayBody(item) {
let name = item.name; let name = item.name;
let url = item.url; let url = item.url;
let color = item.color; let color = item.color;
body.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 body.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1
} }
function fillArrayMouth(item){ function fillArrayMouth(item) {
let name = item.name; let name = item.name;
let url = item.url; let url = item.url;
mouth.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 mouth.push ([name, url]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1
} }
function fillArrayArms(item){ function fillArrayArms(item) {
let name = item.name; let name = item.name;
let url = item.url; let url = item.url;
let color = item.color; let color = item.color;
arms.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1 arms.push ([name, url, color]); //Two dimensional array, Second dimension holds name on index 0 and url at index 1
} }
function fillArraysArms(){ function fillArraysArms() {
for (let i=0; i<arms.length; i++){ for (let i=0; i<arms.length; i++){
if (arms[i][2] == "blue" || arms[i][2] == ""){ if (arms[i][2] == "blue" || arms[i][2] == ""){
arms_blue.push(i); arms_blue.push(i);
@ -147,7 +147,7 @@ function fillArraysArms(){
function onClick_body_next(){ function onClick_body_next() {
index_body++; index_body++;
if (index_body == body.length) {index_body = 0;} //check if index is too big for the array if (index_body == body.length) {index_body = 0;} //check if index is too big for the array
@ -166,7 +166,7 @@ function onClick_body_next(){
arms_name.innerHTML = arms[index_arms][0]; //Change arms name in controls arms_name.innerHTML = arms[index_arms][0]; //Change arms name in controls
} }
function onClick_body_prev(){ function onClick_body_prev() {
index_body--; index_body--;
if (index_body < 0) {index_body = (body.length-1);} //check if index is too big for the array if (index_body < 0) {index_body = (body.length-1);} //check if index is too big for the array
@ -185,7 +185,7 @@ function onClick_body_prev(){
arms_name.innerHTML = arms[index_arms][0]; //Change arms name in controls arms_name.innerHTML = arms[index_arms][0]; //Change arms name in controls
} }
function onClick_eyes_next(){ function onClick_eyes_next() {
index_eyes++; index_eyes++;
if (index_eyes == eyes.length) {index_eyes = 0;} //check if index is too big for the array if (index_eyes == eyes.length) {index_eyes = 0;} //check if index is too big for the array
@ -194,7 +194,7 @@ function onClick_eyes_next(){
eyes_name.innerHTML = eyes[index_eyes][0]; //Change name in controls eyes_name.innerHTML = eyes[index_eyes][0]; //Change name in controls
} }
function onClick_eyes_prev(){ function onClick_eyes_prev() {
index_eyes--; index_eyes--;
if (index_eyes < 0) {index_eyes = (eyes.length-1);} //check if index is too big for the array if (index_eyes < 0) {index_eyes = (eyes.length-1);} //check if index is too big for the array
@ -203,7 +203,7 @@ function onClick_eyes_prev(){
eyes_name.innerHTML = eyes[index_eyes][0]; //Change name in controls eyes_name.innerHTML = eyes[index_eyes][0]; //Change name in controls
} }
function onClick_mouth_next(){ function onClick_mouth_next() {
index_mouth++; index_mouth++;
if (index_mouth == mouth.length) {index_mouth = 0;} //check if index is too big for the array if (index_mouth == mouth.length) {index_mouth = 0;} //check if index is too big for the array
@ -212,7 +212,7 @@ function onClick_mouth_next(){
mouth_name.innerHTML = mouth[index_mouth][0]; //Change name in controls mouth_name.innerHTML = mouth[index_mouth][0]; //Change name in controls
} }
function onClick_mouth_prev(){ function onClick_mouth_prev() {
index_mouth--; index_mouth--;
if (index_mouth < 0) {index_mouth = (mouth.length-1);} //check if index is too big for the array if (index_mouth < 0) {index_mouth = (mouth.length-1);} //check if index is too big for the array
@ -221,7 +221,7 @@ function onClick_mouth_prev(){
mouth_name.innerHTML = mouth[index_mouth][0]; //Change name in controls mouth_name.innerHTML = mouth[index_mouth][0]; //Change name in controls
} }
function onClick_arms_next(){ function onClick_arms_next() {
index_color++; index_color++;
if (body[index_body][2] == "blue"){ if (body[index_body][2] == "blue"){
@ -253,7 +253,7 @@ function onClick_arms_next(){
arms_name.innerHTML = arms[index_arms][0]; //Change name in controls arms_name.innerHTML = arms[index_arms][0]; //Change name in controls
} }
function onClick_arms_prev(){ function onClick_arms_prev() {
index_color--; index_color--;
if (body[index_body][2] == "blue"){ if (body[index_body][2] == "blue"){
@ -285,7 +285,7 @@ function onClick_arms_prev(){
arms_name.innerHTML = arms[index_arms][0]; //Change name in controls arms_name.innerHTML = arms[index_arms][0]; //Change name in controls
} }
function randomize(){ //Randomize which parts are shown function randomize() { //Randomize which parts are shown
index_body = Math.floor(Math.random() * body.length); index_body = Math.floor(Math.random() * body.length);
index_eyes = Math.floor(Math.random() * eyes.length); index_eyes = Math.floor(Math.random() * eyes.length);
index_mouth = Math.floor(Math.random() * mouth.length); index_mouth = Math.floor(Math.random() * mouth.length);
@ -329,7 +329,7 @@ function randomize(){ //Randomize which parts are shown
arms_name.innerHTML = arms[index_arms][0]; arms_name.innerHTML = arms[index_arms][0];
} }
function exportImage(){ //Export image so it can be saved as one PNG function exportImage() { //Export image so it can be saved as one PNG
let ctx=canvas.getContext("2d"); let ctx=canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.clearRect(0, 0, canvas.width, canvas.height);