How easing fits into an animation segment

Easing functions are added into the keyframes of a servo; so not only are we saying what position we want the servo to be, but how it gets there. For example, these keyframes:

let keyframes = [
null,
{degrees: 180, easing: 'inoutcirc'}
]

Will take a servo starting at any position and move it to 180, starting out slow, speeding up in the middle, and slowing down again towards the end.

There are many different options for easing, and they are documented in the ease-component (https://www.npmjs.com/package/ease-component) npm module included as a dependency to Johnny-Five. We'll be using incirc, outcirc, and inoutcirc to start.

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

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