@@ -2551,6 +2551,10 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
25512551 trans . _frameQueue . push ( nextFrame ) ;
25522552 }
25532553
2554+ if ( animationOpts . mode === 'immediate' ) {
2555+ trans . _lastFrameAt = - Infinity ;
2556+ }
2557+
25542558 if ( ! trans . _animationRaf ) {
25552559 beginAnimationLoop ( ) ;
25562560 }
@@ -2571,7 +2575,7 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
25712575 var newFrame = trans . _currentFrame = trans . _frameQueue . shift ( ) ;
25722576
25732577 if ( newFrame ) {
2574- trans . _lastframeat = Date . now ( ) ;
2578+ trans . _lastFrameAt = Date . now ( ) ;
25752579 trans . _timetonext = newFrame . frameOpts . duration ;
25762580
25772581 Plots . transition ( gd ,
@@ -2600,14 +2604,14 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
26002604 gd . emit ( 'plotly_animating' ) ;
26012605
26022606 // If no timer is running, then set last frame = long ago:
2603- trans . _lastframeat = 0 ;
2607+ trans . _lastFrameAt = - Infinity ;
26042608 trans . _timetonext = 0 ;
26052609 trans . _runningTransitions = 0 ;
26062610 trans . _currentFrame = null ;
26072611
26082612 var doFrame = function ( ) {
26092613 // Check if we need to pop a frame:
2610- if ( Date . now ( ) - trans . _lastframeat > trans . _timetonext ) {
2614+ if ( Date . now ( ) - trans . _lastFrameAt > trans . _timetonext ) {
26112615 nextFrame ( ) ;
26122616 }
26132617
0 commit comments