javascript - Animation in KineticJS -
i have circle added layer. in top of layer added text. run animation when mouse on circle, when mouse reaches text mouseout
callback function called. how can prevent that?
var circle = new kinetic.circle({ x: j * xcenterstep + xshift, y: * ycenterstep + yshift, radius: t_radius, fill: t_fill, stroke: t_stroke, strokewidth: t_stroke_w, strokeopacity: 0.1, opacity: 0.3 + t_number * 0.05, }); if (t_number) { circle.tw; circle.on("mouseover", function () { this.tw = new kinetic.tween({ node: this, duration: 0.3, strokewidth: 6 }); this.tw.play(); }); circle.on("mouseout", function () { this.tw.reverse(); }); } // adding text var radiustext = new kinetic.text({ x : circle.getx(), y : circle.gety(), text : t_number, fontsize : radius, fill : '#fff', fontstyle: 'bold', align : 'center' }); radiustext.setoffset({ x : radiustext.getwidth()/2, y : radiustext.getheight()/2 }); bglayer.add(circle); bglayer.add(radiustext);
i think better use mouseenter
event. can disable text's events prevent mouseout
circle.
radiustext.listening(false)
Comments
Post a Comment