@@ -2551,6 +2551,10 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2551
2551
trans . _frameQueue . push ( nextFrame ) ;
2552
2552
}
2553
2553
2554
+ if ( animationOpts . mode === 'immediate' ) {
2555
+ trans . _lastFrameAt = - Infinity ;
2556
+ }
2557
+
2554
2558
if ( ! trans . _animationRaf ) {
2555
2559
beginAnimationLoop ( ) ;
2556
2560
}
@@ -2571,7 +2575,7 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2571
2575
var newFrame = trans . _currentFrame = trans . _frameQueue . shift ( ) ;
2572
2576
2573
2577
if ( newFrame ) {
2574
- trans . _lastframeat = Date . now ( ) ;
2578
+ trans . _lastFrameAt = Date . now ( ) ;
2575
2579
trans . _timetonext = newFrame . frameOpts . duration ;
2576
2580
2577
2581
Plots . transition ( gd ,
@@ -2600,14 +2604,14 @@ Plotly.animate = function(gd, frameOrGroupNameOrFrameList, animationOpts) {
2600
2604
gd . emit ( 'plotly_animating' ) ;
2601
2605
2602
2606
// If no timer is running, then set last frame = long ago:
2603
- trans . _lastframeat = 0 ;
2607
+ trans . _lastFrameAt = - Infinity ;
2604
2608
trans . _timetonext = 0 ;
2605
2609
trans . _runningTransitions = 0 ;
2606
2610
trans . _currentFrame = null ;
2607
2611
2608
2612
var doFrame = function ( ) {
2609
2613
// Check if we need to pop a frame:
2610
- if ( Date . now ( ) - trans . _lastframeat > trans . _timetonext ) {
2614
+ if ( Date . now ( ) - trans . _lastFrameAt > trans . _timetonext ) {
2611
2615
nextFrame ( ) ;
2612
2616
}
2613
2617
0 commit comments