@@ -34,8 +34,9 @@ var __assign = (this && this.__assign) || function () {
3434 duration : 2 ,
3535 useEasing : true ,
3636 useGrouping : true ,
37- autoSmoothThreshold : 999 ,
38- autoSmoothAmount : 333 ,
37+ smartEaseEnabled : true ,
38+ smartEaseThreshold : 999 ,
39+ smartEaseAmount : 333 ,
3940 separator : ',' ,
4041 decimal : '.' ,
4142 prefix : '' ,
@@ -149,13 +150,16 @@ var __assign = (this && this.__assign) || function () {
149150 this . error = '[CountUp] target is null or undefined' ;
150151 }
151152 }
152- CountUp . prototype . determineIfWillAutoSmooth = function ( start , end ) {
153+ CountUp . prototype . determineCountDownAndSmartEase = function ( start , end ) {
154+ this . countDown = ( start > end ) ;
155+ if ( ! this . options . smartEaseEnabled ) {
156+ return ;
157+ }
153158 var animateAmount = end - start ;
154- this . countDown = ( this . startVal > this . endVal ) ;
155- if ( Math . abs ( animateAmount ) > this . options . autoSmoothThreshold ) {
159+ if ( Math . abs ( animateAmount ) > this . options . smartEaseThreshold ) {
156160 this . finalEndVal = end ;
157161 var up = ( this . countDown ) ? 1 : - 1 ;
158- this . endVal = this . endVal + ( up * this . options . autoSmoothAmount ) ;
162+ this . endVal = this . endVal + ( up * this . options . smartEaseAmount ) ;
159163 this . duration = this . duration / 2 ;
160164 }
161165 else {
@@ -177,7 +181,7 @@ var __assign = (this && this.__assign) || function () {
177181 this . callback = callback ;
178182 if ( this . duration > 0 ) {
179183 // auto-smooth large numbers
180- this . determineIfWillAutoSmooth ( this . startVal , this . endVal ) ;
184+ this . determineCountDownAndSmartEase ( this . startVal , this . endVal ) ;
181185 this . paused = false ;
182186 this . rAF = requestAnimationFrame ( this . count ) ;
183187 }
@@ -221,7 +225,7 @@ var __assign = (this && this.__assign) || function () {
221225 }
222226 this . finalEndVal = null ;
223227 this . startVal = this . frameVal ;
224- this . determineIfWillAutoSmooth ( this . startVal , this . endVal ) ;
228+ this . determineCountDownAndSmartEase ( this . startVal , this . endVal ) ;
225229 this . rAF = requestAnimationFrame ( this . count ) ;
226230 } ;
227231 CountUp . prototype . printValue = function ( val ) {
0 commit comments