diff --git a/journal/_src/posts/2022-10-26-lab-13.md b/journal/_src/posts/2022-10-26-lab-13.md new file mode 100644 index 0000000..6825419 --- /dev/null +++ b/journal/_src/posts/2022-10-26-lab-13.md @@ -0,0 +1,9 @@ + Title: Lab Thirteen + Date: 2022-10-26T08:30:00 + Tags: cs2613, lab, javascript + +Sample description + + +## Sample Body +Sample Body \ No newline at end of file diff --git a/labs/L13/animation.js b/labs/L13/animation.js new file mode 100644 index 0000000..3c85b15 --- /dev/null +++ b/labs/L13/animation.js @@ -0,0 +1,39 @@ +// let str=""; +// for (let i=0; i<60; i++) { +// console.log('\033c'); +// str+= "*"; +// console.log(str); +// } + +//console.log("all done!"); + +// function loop(i,str) { +// if (i>0) { +// console.log("\033c"); +// console.log(str); +// setTimeout(function() { loop(i-1, str+"*"); }, 1000); +// } +// } + +// loop(20,"*"); + +// console.log("all done!"); + +function animate(iterations) { + let i=0; + let str="*"; + let timer = null; + function frame() { + + console.log('\033c'); + console.log(str); + if (i>=iterations) { + clearInterval(timer); + console.log("all done!"); + } + + } + timer=setInterval(frame,300); +} + +animate(20); \ No newline at end of file