Lowest price ever! Learn Generative AI for 48% less!
Get my discount+ 3
Break it up
60 BPM means 60 beats will play in one minute. In your application, 4 steps = 1 beat therefore 240 steps play each minute. 120 BPM means 120 beats per minute, 480 steps per minute.
Use BPM/60
With this math you can easily do it now ;)
To make it play at certain times, use a delay such as setTimeout, fake fetch, or use requestAnimationFrame and limit/delay the frames.
SetTimeout is the easiest IMO since your timing wont rely on any animations.
+ 2
you're welcome!
+ 1
Make the design responsive. It goes off screen in phones.