Y.Anim as an animation controller

by Derek Gathright

JavaScript

YUI().use('anim', function (Y) {

    var animation = new Y.Anim({
        iterations: 10,
        duration: .1,
        on: {
            'iterationCountChange': function (e) {
                var frame = e.prevVal, 
                        iterations = this.get('iterations'),
                        fps = (1/this._runtimeAttr.duration) * 1000;

                console.log('Rendering frame ' + frame + ' of ' + iterations + ' @ ' + fps + 'fps');
            }
        }        
    }).run();

});