From b46df221050e4b6826a7157db384a1b36683dd7a Mon Sep 17 00:00:00 2001 From: s1n Date: Wed, 24 Jul 2019 04:37:42 -0700 Subject: Delete app.js --- js/app.js | 149 -------------------------------------------------------------- 1 file changed, 149 deletions(-) delete mode 100644 js/app.js (limited to 'js') diff --git a/js/app.js b/js/app.js deleted file mode 100644 index b943d69..0000000 --- a/js/app.js +++ /dev/null @@ -1,149 +0,0 @@ -window.onload = ()=>{ - animate() - } - - function animate() { - animateFrame( "bobAnimate", 70, [ - { // run right - move: ()=>{ bobAnimate.style.marginLeft = "300px" }, - frames: [ bob_right, bob_right_walk1, bob_right_walk2 ], - delay: 100, - limitFrames: 15, - }, - { // stop blink , blink - frames: [ bob_right_blink, bob_right, bob_right_blink, bob_right, bob_left ], - delay: 150, - limitFrames: 5, - }, - { // turn left, blink - frames: [ bob_left_blink, bob_left ], - delay: 500, - limitFrames: 2, - }, - { // run left - move: ()=>{ bobAnimate.style.marginLeft = "80px" }, - frames: [ bob_left_walk1, bob_left_walk2, bob_left ], - delay: 100, - limitFrames: 15 - }, - { // stop blink - frames: [ bob_left, bob_left_blink, bob_left ], - delay: 500, - limitFrames: 3, - }, - { // turn & blink, blink - frames: [ bob_right, bob_right_blink, bob_right, bob_right_blink, bob_right ], - delay: 100, - limitFrames: 5, - }, - { // run right - move: ()=>{ bobAnimate.style.marginLeft = "200px" }, - frames: [ bob_right, bob_right_walk1, bob_right_walk2 ], - delay: 100, - limitFrames: 13, - }, - { // turn, turn, turn - frames: [ bob_left, bob_right, bob_left ], - delay: 250, - limitFrames: 3, - }, - { // angry, angry - frames: [ bob_left_angry, bob_left, bob_left_angry, bob_left ], - delay: 150, - limitFrames: 4, - }, - { // run left - move: ()=>{ bobAnimate.style.marginLeft = "0px" }, - frames: [ bob_left_walk1, bob_left_walk2, bob_left ], - delay: 100, - limitFrames: 15 - }, - { // turn slow, blnk slow - frames: [ bob_right, bob_right_blink, bob_right ], - delay: 1000, - limitFrames: 3, - }, - { // RESTART - move: ()=>{ animate() }, frames: [], delay: 0, limitFrames: 0 - }, - ]) - } - - function buildFrame(elmId, frameWidth, frame) { - const pW = frameWidth/8 - const elm = document.getElementById(elmId) - elm.innerHTML = ` - - - - - - - - - - - - - - - - - ` - setPixels(elmId, frame) - } - - function setPixels(elmId, frame) { - const g = document.getElementById("g-"+elmId) - g.innerHTML = "" - frame.pixels.map( p => { - g.innerHTML += /*html*/` - - - ` - }) - } - - function animateFrame(elmId, size, anime){ - - buildFrame("bobAnimate", size, anime[0].frames[0]) - anime[0].frames.push(anime[0].frames[0]) - anime[0].frames.shift() - - const g = document.getElementById("g-"+elmId) - - function animate(anime) { - - const int = setInterval(function(){ - if (anime[0].limitFrames === 0) { - clearInterval(int) - anime.shift() - if (anime.length > 0) { - if (anime[0].move) anime[0].move() - animate(anime) - } - } else { - setPixels(elmId, anime[0].frames[0]) - anime[0].frames.push(anime[0].frames[0]) - anime[0].frames.shift() - anime[0].limitFrames-- - } - }, anime[0].delay) - - } - - if (anime[0].move) anime[0].move() - animate(anime) - - } - \ No newline at end of file -- cgit v1.2.3