javascript - easeljs animate endAngle of arc -
using easeljs how animate endangle of arc
i tried make own property pie.setmyangle = 0.1;
, increment in tick did not work
function init() { var canvas = document.getelementbyid('easel'); var stage = new createjs.stage(canvas); var pie = new createjs.shape(); pie.setmyangle = 0.1; pie.graphics.beginfill("rgba(255,255,255,1)").arc(75, 75, 75, 0, math.pi * pie.setmyangle, false).lineto(75, 75).closepath(); stage.addchild(pie); createjs.ticker.addeventlistener("tick", handletick); function handletick() { pie.setmyangle += 0.1; //not working pie.x += 1 stage.update(); } }
changing custom properties (e.g. setmyangle
) doesn't automatically update shape; you'll have redraw yourself. example, move drawing code handletick
method:
function handletick() { pie.setmyangle += 0.1; pie.x += 1; pie.graphics.clear(); pie.graphics.beginfill("rgba(255,255,255,1)").arc(75, 75, 75, 0, math.pi * pie.setmyangle, false).lineto(75, 75).closepath(); stage.update(); }
Comments
Post a Comment