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

Animation events


A lot of movements require waiting for one segment to finish before starting another. Some segments should only be fired at certain times, as well. The best way to handle these timings and communication systems is by using Johnny-Five's animation events.

We tap into these events by assigning callbacks to special attributes on segments. Let's go into the details of each one and see when they will fire.

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

Events

Details

onstart

The onstart callback fires when the segment has begun playing in the animation.

onstop

The onstop callback is only called when the segment is either in the queue or currently running, but the animation is stopped via animation.stop().

onpause

The onpause callback is only called when the segment is queued or running in an animation that has been paused via animation.pause().

oncomplete

The oncomplete callback only fires when the segment has completed running in an animation. Note: This does NOT apply to looped segments. See the onloop...