import * as SpriteSpin from '../core' ; SpriteSpin . extendApi ( { isPlaying : function ( ) { return SpriteSpin . getPlaybackState ( this . data ) . handler != null ; } , isLooping : function ( ) { return this . data . loop ; } , toggleAnimation : function ( ) { if ( this . isPlaying ( ) ) { this . stopAnimation ( ) ; } else { this . startAnimation ( ) ; } } , stopAnimation : function ( ) { this . data . animate = false ; SpriteSpin . stopAnimation ( this . data ) ; } , startAnimation : function ( ) { this . data . animate = true ; SpriteSpin . applyAnimation ( this . data ) ; } , loop : function ( value ) { this . data . loop = value ; SpriteSpin . applyAnimation ( this . data ) ; return this ; } , currentFrame : function ( ) { return this . data . frame ; } , updateFrame : function ( frame , lane ) { SpriteSpin . updateFrame ( this . data , frame , lane ) ; return this ; } , skipFrames : function ( step ) { const data = this . data ; SpriteSpin . updateFrame ( data , data . frame + ( data . reverse ? - step : + step ) ) ; return this ; } , nextFrame : function ( ) { return this . skipFrames ( 1 ) ; } , prevFrame : function ( ) { return this . skipFrames ( - 1 ) ; } , playTo : function ( frame , options ) { const data = this . data ; options = options || { } ; if ( ! options . force && data . frame === frame ) { return ; } if ( options . nearest ) { const a = frame - data . frame ; const b = frame > data . frame ? a - data . frames : a + data . frames ; const c = Math . abs ( a ) < Math . abs ( b ) ? a : b ; data . reverse = c < 0 ; } data . animate = true ; data . loop = false ; data . stopFrame = frame ; SpriteSpin . applyAnimation ( data ) ; return this ; } } ) ;