Question

After I upgrade kineticjs 4.5.3 to 5.0.1, tween play function doesn't work. My function is

ZoomOnPoint: function (pos, delta, options) {
    options || (options = {});
    var viewport = gstage.getPosition();
    var scale1 = gstage.getScale().x;
    var scale2 = scale1 + delta;
    if ((scale1 < 2 && delta > 0) || (scale1 > 0.5 && delta < 0)) {
        if (options == true) {

        }
        else {
            // can't see the animation
            var tween = new Kinetic.Tween({
                node: gstage,
                x: -((pos.x - viewport.x) * (scale2 / scale1)) + pos.x,
                y: -((pos.y - viewport.y) * (scale2 / scale1)) + pos.y,
                duration: 0.5,
                easing: Kinetic.Easings.StrongEaseOut,
                scaleX: scale2,
                scaleY: scale2,
                onFinish: function () {
                    this.destroy();
                    }
            });
            tween.play();
        }

    }

The input parameter x, y scaleX, scaleY is same as in 4.5.3. Any one can give me some ideas? Thanks

Était-ce utile?

La solution

Something wrong with your code, but main usage of Kinetic.Tween is correct. Your working tween demo: http://jsbin.com/dakog/1/edit

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