Changing the speed of animation segments

You can call Animation.speed() with a numeric multiplier to change the speed of the current animation segment. For instance, calling Animation.speed(.5) will halve the speed, and Animation.speed(2) will double it.

Let's write some functions to half, double, and normalize our animation segment speed:

function halfSpeed() {
myFirstAnimation.speed(.5)
}

function doubleSpeed() {
myFirstAnimation.speed(2)
}

function regularSpeed() {
myFirstAnimation.speed(1)
}

Add these to the loop and metronome functions.

Now that we know how to adjust the speed of animation functions, as well as how to loop them, let's talk about pausing, playing, and stopping animations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.96.146