Skip to content

Amination

csiejoey edited this page Nov 12, 2017 · 1 revision

Whenever a sound occurs, we draw a visual by two.js, and animate it by tween.js.


Setup

Setup the array named animation to store animations/animations set with parameters, which would be used by Two and Tween.

When changeSequencerAnimations is triggered, we reset two and pass the new currentSequencerAnimationsIndex to setSequencerAnimations.

Trigger

Keyboard

Map the played key to its matching animation index by animationKey2IndexMapping, then pass it to trigger the animation.

Sequencer

Pass the indexes of clicked elements in the played column to triggerSequencerAnimation.

Animate

Setup

Calculate the current window size, draw shapes and color them by two.js methods, or import images.

By tween.js methods, we use aniIn to describe the entering movement of the above-mentioned visual, and aniOut for exiting movement.

We listen on window size changing by react-window-resize-listener. Whenever the new window size is passed in, we modify the size of visuals as well as the canvas.

Play

.start() of an animation invokes the aniIn.start() within. The visual is drawn and its parameters update smoothly, animating it. aniOut() is included in aniIn() so it would be triggered consequently.


Naruto (Hidden Feature)

Send a boolean value to turn on Naruto mode, which pass new currentSampleIndex to loadSamples() and new currentKeyAnimationsIndex to both setSequencerAnimations() and setKeyAnimation().

Clone this wiki locally