code-dot-org / dance-party

Renderer for the Dance game type. Based on p5.js and p5.play.js.
https://code-dot-org.github.io/dance-party/
13 stars 13 forks source link

Assign default bpm value for sparkles background effect #653

Closed fisher-alice closed 1 year ago

fisher-alice commented 1 year ago

This PR adds to the sparkles background effect a default value of 120 for the bpm. It is the only background effect whose draw function passes bpm as a parameter. The new 'preview' feature that will be added by https://github.com/code-dot-org/code-dot-org/pull/53817 calls on the draw nativeAPI function but does not load the selected song. Thus, we need to provide a default bpm value when the sparkles background effect is called on in preview mode.

There was a testBackground test failure for 'sparkles' after I added the default bpm value to the 'sparkle' draw function because the expected value for the test is 0. The test image is expecting a bpm value of 0. See this commit which confirms this. I deleted the current 'sparkles' baseline image, and a new one was created based on this logic that will be used for subsequent tests - test is now passing.

Here's a screencast video AFTER the update of the 'sparkles' background effect displayed in preview mode.

https://github.com/code-dot-org/dance-party/assets/107423305/05204f3a-8aee-418f-918e-e57633191f23