我不知道如何在 setInterval 中的函数起作用时改变速度..
在代码中:
var timeout, count = 0, speed = 5000;
$('#stage').mousedown(function() {
timeout = setInterval(function() {
speed = parseInt(speed / 1.3); // HERE I want change speed
create(speed); // Some Function
}, speed); // This speed, I don't know how to change
});
$('#stage').mouseup(function() {
count = 0;
clearInterval(timeout);
});
这项工作,但速度在功能之外是 const (5000)
非常感谢所有帮助!