I'm trying to animate a shape i've created in HTML5.
myShape.drawFunc = function(){
var context = this.getContext();
context.beginPath();
context.arc(480, 480, animationValue, startingPoint * Math.PI, endingPoint * Math.PI, false);
context.lineTo(480,480);
context.closePath();
this.fillStroke();
}
I want to use jQuery.animate to change the animationValue
from one value to another overtime. I'm not really sure how to achieve this, also I will need to run a function on every step of the animation Layer.draw();
because my shape is a canvas shape.
Anyone know how to animate the animationValue
in myShape.drawFunc ?
I should add that I'm trying to animate within a myShape.on("mouseover",{});
does this pose any problem using the setInterval method etc?
UPDATE:
segment.on("mouseover",function(){
var startingPoint = segData[index].startingPoint;
var endingPoint = segData[index].endingPoint;
var startingRadias = segData[index].radias;
var maxRadias = 250;
var updateRadias = startingRadias;
setInterval(function(){
if(updateRadias < maxRadias){
updateRadias++;
console.log("frame : "+updateRadias);
this.drawFunc = function(){
var context = this.getContext();
context.beginPath();
context.arc(480, 480, updateRadias, startingPoint * Math.PI, endingPoint * Math.PI, false);
context.lineTo(480,480);
context.closePath();
this.fillStroke();
}
rawLayer.draw();
}
},1000/30);
});
the console.log is showing the they setInterval is being called but the shape doesn't seem to be redraw.