Reader small image

You're reading from  Learning JavaScript Robotics

Product typeBook
Published inNov 2015
Reading LevelIntermediate
Publisher
ISBN-139781785883347
Edition1st Edition
Languages
Tools
Concepts
Right arrow
Author (1)
Kassandra Perch
Kassandra Perch
author image
Kassandra Perch

Kassandra Perch is an open web developer and supporter. She began as a frontend developer and moved to server-side with the advent of Node.js and was especially enthralled by the advance of the NodeBots community. She travels the world speaking at conferences about NodeBots and the fantastic community around them.
Read more about Kassandra Perch

Right arrow

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:

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Learning JavaScript Robotics
Published in: Nov 2015Publisher: ISBN-13: 9781785883347

Author (1)

author image
Kassandra Perch

Kassandra Perch is an open web developer and supporter. She began as a frontend developer and moved to server-side with the advent of Node.js and was especially enthralled by the advance of the NodeBots community. She travels the world speaking at conferences about NodeBots and the fantastic community around them.
Read more about Kassandra Perch

Keyframe

Properties

degrees

degrees is what the name implies; the degree you want the servo to be at when the keyframe is reached. It should be an integer value between 0 and 180 inclusive.

step

step is similar to degrees...