Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metronome.start() is called more than once when starting an animation #64

Closed
JoelHobson opened this issue Jun 12, 2019 · 2 comments
Closed

Comments

@JoelHobson
Copy link

It looks like when you use a Tempo object to keep time, it calls start multiple times with the same count for steps 0 and 1.

Here's some code to reproduce - assumes you've got a space defined somewhere.

const tempo = new Tempo(120);
tempo.every(2).start((count) => {
    console.log('on start: ', count);
});
space.add(tempo);
space.play()

I'm expecting the start function to be called once every two beats, but instead, I'm seeing an 'on start: count' message multiple times per beat. The console.log message is just printing out the same value over and over until the count changes.

@williamngan
Copy link
Owner

Hi @JoelHobson - thank you so much for catching this bug.

It's now fixed and you can try it here (uncomment console.log on line 20):
https://ptsjs.org/demo/edit/?name=guide.tempo_progress

See if that works for you. Thanks again!

@JoelHobson
Copy link
Author

That fixed it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants