I am rotating a model. When I click start button it starts from 0
start = animateAssembly
I am trying to resume from width
. What ever value of width
will be there my animation will start from there.
resume = resumeAssembly
but width variable returning as NaN
inside frame.
and not getting passed into 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 + "%";
},