Adobe Animate CC 2020 Tutorial - advanced if else in HTMl5 canvas - JavaScript

Опубликовано: 13 Февраль 2026
на канале: MotionTuts
3,697
53

in this tutorial, I will show you an advanced if-else statement with JavaScript in HTML5 canvas.

you can download my project file in here :
https://drive.google.com/file/d/1QhjT...

here is the whole code that we used :

//yellowShape blueShape noneShape oneShape bothShape myResult myRefresh
var root = this;

function hideText () {
root.noneShape.visible=false;
root.oneShape.visible=false;
root.bothShape.visible=false;
}

hideText()

this.myRefresh.addEventListener("click", myRefreshF);

function myRefreshF() {
root.blueShape.visible=true;
root.yellowShape.visible=true;
}

this.yellowShape.addEventListener("click", yellowF);


function yellowF () {

root.yellowShape.visible=false;

}


this.blueShape.addEventListener("click", blueF);

function blueF () {

root.blueShape.visible=false;

}
Thank you for your time :)



this.myResult.addEventListener("click", myResultF);

function myResultF () {

if(root.yellowShape.visible==false && root.blueShape.visible==false ) {
hideText()
root.noneShape.visible=true
} else if (root.yellowShape.visible==true && root.blueShape.visible==true) {
hideText()
root.bothShape.visible=true
} else {
hideText()
root.oneShape.visible=true
}

}