Question

I'm trying to do an accordion implementation using Kinetic.Tween, when I click on the rectangle, it moves to the top for example. This is what I've done so far,

Code:

function animate (node,x,y,d) {
var t=new Kinetic.Tween({
        node:node,
        x:x,
        y:y,
        duration: d,
        onFinish:function(){
            layer.draw();
        }
    });
    t.play();
}
rec.on('click', function () {
animate(rec,0,80,0.3);
stage.draw();
});

and here's the jsfiddle: http://jsfiddle.net/tmtB5/

Était-ce utile?

La solution

In your fiddle, you have set the stage to listening: false. So your click event listener did not work. Removing that fixed it, see also: http://jsfiddle.net/tmtB5/1/

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top