Dance—MRlib Animation Controller Function

© 2012, Martin Rinehart

dance()

dance( element, dance_steps );

dance() is a single-element, multi-morph dance controller.

The dance_steps are an array of two-element arrays, a time and the styles to apply over that time:

var dance_steps = [
    [time0, styles0],
    [time1, styles1],
    ...
];

Example: 'dancer' holds at 100, 100 for a second. Slides left to 200,100 over next half a second. Leaps to 200, 0 over next second.

// 'dancer' is at 100, 100

var dance_steps = [
    [1000, {}],
    [ 500, { left: '200px' }],
    [1000, { top: '0px' }]
];

dance( dancer, dance_steps );

Uses morph_change_specs() to do the morphs. See Animation / Morph Functions for available morphs.


Feedback: MartinRinehart at gmail dot com

# # #