Implementation code for
JS pure digits to stop display effects
function Showscore ($ele, num, Secand, pause) {//second How many seconds the animation runs per second if (!secand) {secand = 2;}
if (!pause) {pause = 20;}
var len = String (num). length;
var temnum, times = 0, steptimes, Max;
var Numarr = String (num). Split (""); function Getrandom (n) {var = math.floor (Math.random () * (Math.pow (n) -1-math.pow (n-1)) +math.pow (n
-1));
if (String (num). length!== n) {num = Getrandom (n);}
return num;
function SetValue (num, pause, Secand) {//second How many seconds to run to stop var len = String (num). length, j=0;
if (!steptimes) {max = Math.ceil (Secand*1000/len);
Steptimes = Math.ceil (Max/pause);
} temnum = "";
settimeout (function () {for (var i = 1; I <= len; i++) {if (Times >= steptimes*i) {
j + +;
Temnum + + numarr[i-1]+ "";
}else{ Break
}
};
if (J < len) {$ele. html (temnum+ "" +getrandom (len-j));
}else{$ele. html (temnum);
} if (Times >= max | | J >= len) {return;};
SetValue (num, pause, secand);
times++;
}, pause);
} setValue (num, pause, secand); } showscore ($ (". Num"), 2344, 1.5, 10);
The effect of pure numbers to stop the display effect, such as the number of constant changes, the first set down first, the second to determine, and then the third to determine. Because the project took a few days to retire, so save the file.
The above JS pure number of the display to stop the implementation code is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.