Writing Servo Animations
As we discussed in the last section, an animation in Johnny-Five is created and then you enqueue segments that run first-in, first-out. We're going to go from the inside out in our exploration of creating an animation: first, we'll learn about writing keyframes, then segments, and finally we'll explore the Animation object.
Writing keyframes
Writing keyframes are at the core of the Animation API—the power of this API is its ability to tween between our keyframes. Each keyframe is an object, and you'll pass your keyframes into your segment via an array. Remember: you'll want to write a keyframe for each of your cue points.
The keyframe object
As each keyframe is an object, we have access to a few properties that we can establish for each one:
Keyframe |
Properties |
---|---|
|
|
|
|