t.grow = function(parent,evt) {
evt.target.Y = 0
var r = parent.radius, that = this
this.loop = function() {
parent.root.suspendRedraw(10000)
evt.target.Y = evt.target.Y - 6
evt.target.setAttribute('transform',
'translate(' + 0 + ',' + evt.target.Y + ')')
r = r + 0.1
evt.target.setAttribute('r',r)
parent.root.unsuspendRedrawAll()
if(evt.target.Y < parent.timeout) {
clearInterval(that.timer)
}
}
that.timer = window.setInterval(this.loop,30)
}
this.el.addEventListener("mouseover",
function(event){
t.grow(parent,event)
},
true)
I really need some help with the above animation.
At the moment the animation is triggered on a mouseover of the object, but what I would really like to achieve is rather than the animation being triggered on an event I would like it to fire at a random time
Basically the second line creates a random number between 0 and 10 then it adds 5 so that you won’t have two animations running back to back.