我正在旋转模型。当我单击开始按钮时,它从0
start = animateAssembly
我正在尝试从width
恢复。 width
的值将在那里存在,而我的动画将从此处开始。
resume = resumeAssembly
但是宽度变量在框架内返回为NaN
。
并且没有传递到resumeAssembly
animateAssembly: function() {
var element = document.getElementById("myBar");
this.width = 1;
clearInterval(this.interval);
this.interval = setInterval(frame,100);
//here my width shows number
console.log(typeof this.width);
function frame() {
if (this.width >= 100) {
console.log(typeof this.width);
clearInterval(this.interval);
} else {
this.width++;
console.log(typeof parseInt(this.width));
console.log(typeof this.width);
//here it shows as NaN
element.style.width = parseInt(this.width) + '%';
element.innerHTML = parseInt(this.width) + "%";
}
}
},pauseAssembly: function() {
clearInterval(this.interval);
this.tweening.stop();
},resumeAssembly: function() {
var element = document.getElementById("myBar");
element.style.width = this.width + '%';
element.innerHTML = this.width + "%";
},