@@ -508,7 +508,6 @@ class SlotMachine {
508508 prev ( ) {
509509 this . futureActive = this . prevIndex ;
510510 this . running = true ;
511- this . slide = true ;
512511 this . stop ( ) ;
513512
514513 return this . futureActive ;
@@ -521,7 +520,6 @@ class SlotMachine {
521520 next ( ) {
522521 this . futureActive = this . nextIndex ;
523522 this . running = true ;
524- this . slide = true ;
525523 this . stop ( ) ;
526524
527525 return this . futureActive ;
@@ -534,6 +532,7 @@ class SlotMachine {
534532 */
535533 getDelayFromSpins ( spins ) {
536534 let delay = this . settings . delay ;
535+ this . _transition = 'linear' ;
537536
538537 switch ( spins ) {
539538 case 1 :
@@ -543,12 +542,10 @@ class SlotMachine {
543542 break ;
544543 case 2 :
545544 delay /= 0.75 ;
546- this . _transition = 'linear' ;
547545 this . _animationFX = FX_SLOW ;
548546 break ;
549547 case 3 :
550548 delay /= 1 ;
551- this . _transition = 'linear' ;
552549 this . _animationFX = FX_NORMAL ;
553550 break ;
554551 case 4 :
@@ -557,7 +554,6 @@ class SlotMachine {
557554 break ;
558555 default :
559556 delay /= 1.5 ;
560- this . _transition = 'linear' ;
561557 this . _animationFX = FX_FAST ;
562558 }
563559
@@ -585,13 +581,14 @@ class SlotMachine {
585581 this . _animate ( this . direction . to ) ;
586582 this . raf ( ( ) => {
587583 if ( ! this . stopping && this . running ) {
588- this . resetPosition ( this . direction . first ) ;
584+ const left = spins - 1 ;
589585
590- if ( spins - 1 <= 0 ) {
586+ this . resetPosition ( this . direction . first ) ;
587+ if ( left <= 1 ) {
591588 this . stop ( ) ;
592589 } else {
593590 // Repeat animation
594- this . shuffle ( spins - 1 ) ;
591+ this . shuffle ( left ) ;
595592 }
596593 }
597594 } , delay ) ;
@@ -618,12 +615,10 @@ class SlotMachine {
618615 }
619616
620617 // Check direction to prevent jumping
621- if ( this . slide ) {
622- if ( this . _isGoingBackward ( ) ) {
623- this . resetPosition ( this . direction . firstToLast ) ;
624- } else if ( this . _isGoingForward ( ) ) {
625- this . resetPosition ( this . direction . lastToFirst ) ;
626- }
618+ if ( this . _isGoingBackward ( ) ) {
619+ this . resetPosition ( this . direction . firstToLast ) ;
620+ } else if ( this . _isGoingForward ( ) ) {
621+ this . resetPosition ( this . direction . lastToFirst ) ;
627622 }
628623
629624 // Update last choosen element index
@@ -637,7 +632,6 @@ class SlotMachine {
637632 this . raf ( ( ) => {
638633 this . stopping = false ;
639634 this . running = false ;
640- this . slide = false ;
641635 this . futureActive = null ;
642636
643637 this . _oncompleteStack . filter ( ( fn ) => typeof fn === 'function' ) . forEach ( ( fn ) => {
0 commit comments