(Tween 综合讨论) 关于 3.8.5 Tween 系统的类型改进

你这补充得很好。赞:+1:t2:,经过你的补充,我好像理解了。
@27185709 感谢反馈,如果是 ListenLee 说的这个问题,我后续看看。

:sweat_smile:我也不知道理解的对不对,因为我没试过编辑器环境下运行tween动作会怎样,看这样子像是在讨论编辑器模式下tween的运行表现,等水煮肉片饭确认下吧。
每个人的思维和表达方式都不一样,让别人理解自己不易,让自己理解别人也不易,我们都需要学习高效的沟通。也能充分理解引擎组在与开发者沟通过程中的感受,希望引擎能越做越好!

对的,就是这样,感谢:pray:

是的,就这个意思,编辑器窗口能直观看到tween当然最好,但是折中一下直接显示终点也OK

但是测试的时候不止要测试终点啊
几个tween一起跑或者中间要调试好几个点怎么办

测过程就运行以后测啊,我说的是没点运行,直接属性面板改属性触发了tween的情况

添加 Tween.reverse, Tween.id, Tween.union(fromId) 支持,关于 API,欢迎提建议和意见。

  • Add Tween.reverse to reverse an action in the current tween or a specific tween
  • Add Tween.id(number) to mark the previous action
  • Add the parameter for Tween.union(fromId: number) to union the internal actions from the action with the ID
  • Doesn’t need to pass a target parameter for Tween.clone() if the same target is required

Usages

Tween.id

const t = tween(node)
    .by(1, { position: new Vec3(100, 0, 0) }).id(123) // Mark the previous `by` action with 123
    .to(1, { position: new Vec3(1000, 0, 0) });

Tween.reverse

  1. Reverse the whole tween
const t = tween(node).by(1, { position: new Vec3(100, 0, 0) });

tween(node)
    .to(1, { position: new Vec3(200, 0, 0) })
    .reverse(t) // Reverse all actions in t
    .start();
  1. Reverse an action by id in another tween
const node = new Node();

const t = tween(node)
    .by(1, { position: new Vec3(100, 0, 0) }).id(123)
    .to(1, { position: new Vec3(1000, 0, 0) });

tween(node)
    .to(1, { position: new Vec3(200, 0, 0) })
    .reverse(t, 123) // Only reverse `.by(1, { position: new Vec3(100, 0, 0) })` in t
    .start();
  1. Reverse an action by id in current tween
const node = new Node();

tween(node)
    .to(1, { scale: new Vec3(10, 10, 10) })
    .by(1, { position: new Vec3(200, 0, 0) }).id(123)
    .delay(1)
    .reverse(123) // Revert the `by` action in the current tween.
    .start();

Tween.union(fromId?: id)

    const node = new Node();

    tween(node)
        .to(1, { scale: new Vec3(10, 10, 10) })
        .by(1, { position: new Vec3(200, 0, 0) }).id(123)
        .delay(1)
        .reverse(123)
        .union(123) // Union from `.by(1, { position: new Vec3(200, 0, 0) })`, ignore the first `.to(...)`
        .repeat(3)
        .start();
1赞

3.8.5会有的

太棒了,3.8.5 的 tween 系统看起来惊人的完善!

3.8.5是不是要等年底了

赞赞赞:partying_face::partying_face::partying_face:

这次对 tween 的重视程度令人兴奋,能否看一下这些建议,本来打算用于重新实现个自己的 Tween System,但现在 3.8.5 的 Tween 系统完成度这么高,就不如一起来完善了,写了 8000 多字有点长,望海涵:

1赞

能不能加个跳到指定进度播放的功能,比如一个tween的时长是10秒,我想让它直接跳到5秒处开始播放。如果有这功能就方便多了。

感谢建议,issue 很详细,建议很多 :+1: 。我们消化一下。我先忙完手头上的事,后续会跟进这个 issue。

感谢建议。
这里有个问题,如果直接跳转到某个时间点,是否应该这个时间点保证之前的所有 actions 都被执行完?

应该不会到年底,计划在 8 月 ~ 9月这样。

因为 Tween 的功能比较独立,我打算把改完的 Tween 功能抽出来,让大家可以放在现有工程中使用(不需要升级到 3.8.5 引擎)。这样我们也可以在发布社区版本前收集到大家的反馈。大家怎么看?

2赞

我忘了是tweenmax这个插件还是啥的,好像是有个跳到指定进度的这个功能。
tweenmax这个插件功能挺强大的,你们可以参考下

是的 TweenMax 的这个功能挺强大的,他还支持在 timeline 中某个子 tween 的前/后多少时间去开始播放另外一个 子 tween。

目前 Cocos 的 Tween 基于之前 Cocos2d-x 的 Action 机制,要支持这个从某个时间开始播放,可能会费劲一些。但我们后续评估看看。

先建一个 issue 备忘吧:https://github.com/cocos/cocos-engine/issues/17078

那太棒了,不过希望不会太影响你的进度

支持的,:+1::+1: