Skip to content

Commit

Permalink
monkey animation!
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiebee committed Nov 5, 2024
1 parent a99a16a commit 7a67b1e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions dev/fun-bucket.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const monkeys = ['🙉 - pandemonium', '🙈 - chaos', '🙊 - anarchy', '🐵 - entropy']
/**
* starts a monkey animation
* @returns {function} to stop animation
**/
export function evilMonkeyAnimation () {
const clear = () => process.stdout.write("\r\x1b[K")
let frame = 0
process.stdout.write(monkeys[frame])
++frame
const animate = setInterval(() => {
clear()
process.stdout.write(monkeys[frame])
if (frame === 3) frame = 0
else ++frame
}, 1000)
return () => {
clearInterval(animate)
}
}

0 comments on commit 7a67b1e

Please sign in to comment.