Closed Magnogen closed 2 years ago
Oops I did a typo in some tests! Gonna do them again :)
Hmm, doesn't seem to be working as intended:
Habitat.install(window);
const lu = {
score: 20
}
const max = 10
const offset = 10
let tickTock = true
setInterval(() => {
if (lu.score === max) return
const count = Math.clamp(offset + lu.score, 0, Infinity)
print(`${tickTock? "+" : "-"}${"#".repeat(count)}`)
tickTock = !tickTock
}, 20)
lu.tween("score", {to: max, ease: Habitat.Tween.SUPER_SMOOTH})
Here's a quick codepen testing out the code we can play around in: https://codepen.io/l2wilson94/pen/zYjOeXg?editors=0010
I saw it in a YouTube video and thought it could go here too