fix animate steps==0 bug

This commit is contained in:
ckcz123 2019-09-12 11:00:49 +08:00
parent 7bad06ab75
commit 6588a0bd1b
2 changed files with 3 additions and 0 deletions

View File

@ -2134,6 +2134,7 @@ control.prototype.setCurtain = function(color, time, callback) {
control.prototype._setCurtain_animate = function (nowColor, color, time, callback) {
time /= Math.max(core.status.replay.speed, 1)
var per_time = 10, step = parseInt(time / per_time);
if (step <= 0) step = 1;
var animate = setInterval(function() {
nowColor = [
(nowColor[0]*(step-1)+color[0])/step,

View File

@ -2157,6 +2157,7 @@ events.prototype.moveImage = function (code, to, opacityVal, time, callback) {
events.prototype._moveImage_moving = function (name, moveInfo, callback) {
var per_time = 10, step = 0, steps = parseInt(moveInfo.time / 10);
if (steps <= 0) steps = 1;
var fromX = moveInfo.fromX, fromY = moveInfo.fromY, toX = moveInfo.toX, toY = moveInfo.toY,
opacity = moveInfo.opacity, toOpacity = moveInfo.toOpacity;
var currX = fromX, currY = fromY, currOpacity = opacity;
@ -2211,6 +2212,7 @@ events.prototype.setVolume = function (value, time, callback) {
var currVolume = core.musicStatus.volume;
time /= Math.max(core.status.replay.speed, 1);
var per_time = 10, step = 0, steps = parseInt(time / per_time);
if (steps <= 0) steps = 1;
var fade = setInterval(function () {
step++;
set(currVolume + (value - currVolume) * step / steps);