Created
July 18, 2018 02:41
-
-
Save malikkurosaki/9b972d4802de206dd314c3a67ac028f3 to your computer and use it in GitHub Desktop.
javascript create circle increment loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
burung() | |
function burung(){ | |
var terbang = true; | |
var kepak = 0; | |
mulai(); | |
function mulai(){ | |
if(terbang == true){ | |
kepak +=1; | |
if(kepak >= 10){ | |
terbang = false; | |
} | |
}else{ | |
if(terbang == false){ | |
kepak -= 1; | |
if(kepak <=0){ | |
terbang = true | |
} | |
} | |
} | |
setTimeout(mulai,100); | |
console.log(kepak) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment