문제

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

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top