Tween的sequence和parallel用法

private PlayViewAnimation(): void {

    let group1 = tween(this.view["_view_content"]).to(0.1, { scale: new Vec3(1.1, 1.1, 1) }, { easing: 'sineOut' })

            .to(0.1, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' });

    // 第一组动画(面板上部)

    let group2 = tween().parallel(

        tween(this.view["_sp_celebrate"]).to(0.2, { scale: new Vec3(1, 1.3, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' }),

        tween(this.view["_labTitle"]).to(0.2, { scale: new Vec3(1.5, 1.5, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' }),

        tween(this.view["_sp_lbBg"]).to(0.2, { scale: new Vec3(1, 1.2, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' })

    );

    // 第二组动画(中部)

    let group3 = tween().parallel(

        tween(this.view["_labTurn"]).to(0.2, { scale: new Vec3(2, 2, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' }),

        tween(this.view["_playerBlue"]).to(0.2, { scale: new Vec3(1.2, 1.2, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' }),

        tween(this.view["_playerRed"]).to(0.2, { scale: new Vec3(1.2, 1.2, 1) }, { easing: 'sineOut' })

            .to(0.2, { scale: new Vec3(1, 1, 1) }, { easing: 'sineIn' })

    );

    // 按顺序播放动画组

    tween()

        .sequence(

            group1,

            group2,

            group3,

        )

        .start();

}有没有懂tween的大佬,为啥这样写运行不了。


你不写target是不会执行的

多谢大佬!再问一下,那像我这种多个不同目标的缓动,能用一个parallel嘛,我看示例都是同一个目标的多个缓动放在一起。

你有几个是一样的时间 到一个缓动的onUpdate去控制节点的缩放就不用每一个都写了 你这写的太多了

能举个例子嘛 大佬 听的有点迷糊


这样你就可以在一个里面去控制多个的运动

学到了 谢谢大佬