I have this object, it works fine but I wanted to add a property to stop, this is not working:
JS:
var kissesAni = {
init: function () {
kissesAni.callAni();
},
callAni: function(){
window.setInterval(function(){
kissesAni.makeImgAni();
}, 30);
},
stop: function() {
window.clearInterval(kissesAni.callFontFlakes);
},
makeImgAni: function(){
...
}
};
kissesAni.init();
window.setTimeout(function() {
console.log('heya');
kissesAni.stop();
}, 5000);
That is, it does console.log('heya')
but the animation does not stop.