Delaying UI Animations in the Godot Engine

Поделиться
HTML-код
  • Опубликовано: 7 ноя 2024

Комментарии • 8

  • @michelveerman
    @michelveerman 2 месяца назад +6

    @StayAtHomeDev The tween_interval doesn't work because you set the set_parallel to true. That causes the interval to run parallel to the tween_properties (thus kind of negating it's use).
    One way to prevent this is to use chains:
    ```
    var tween: Tween = get_tree().create_tween()
    tween.set_parallel(parallel)
    tween.tween_interval(delay)
    var chain: Tween = tween.chain()
    for property in properties:
    chain.tween_property(...)
    ```
    Edit: Just now noted that @prateekmalhotra8552 also mentioned the same 🙂.

  • @Kio_Kurashi
    @Kio_Kurashi 3 месяца назад

    Then here's me who created a coin spawning animation that spawns several coins, moves them outward in a circle, and then zips them to wherever the money bag is at.
    I spawned instances of timers and awaited the finished signal from those to do my little wait between steps. XD Although to be fair, I was also playing sounds along with it so I wouldn't have been able to do the one line shown in the vid anyway.

  • @xscreade2
    @xscreade2 21 день назад

    This doesn't work if the node gets its properties modified after the initial setup by something external: for exemple if have my buttons with each an AnimationComponent in a vertical box container, and if I hide or show a child, then the vertical box container arranges its children but the values for AnimationComponent being stored as hard values at the begining makes it so that the buttons use the properties they add before that rearrangment.

  • @prateekmalhotra8552
    @prateekmalhotra8552 3 месяца назад +5

    I am not sure if this will work for your specific logic but have you tried chaining tweens?
    Something like this usually does the job for me: tweenojb.chain().tween_interval(1.0).chain() ...

    • @MuffinMan_Ken
      @MuffinMan_Ken 3 месяца назад

      You shouldn't even need the chain() as long as you do the interval before setting parallel to true. But I agree that it's simpler to just do it all within the Tween.

    • @michelveerman
      @michelveerman 2 месяца назад

      @@MuffinMan_Ken No, that's not true. Setting the interval before set_parallel makes no difference. You really need chain.

    • @MuffinMan_Ken
      @MuffinMan_Ken 2 месяца назад

      @@michelveerman I looked at this more closely because I have code that does this and it's very non-intuitive to me. If you do:
      tween_cmd_1
      tween_cmd_2
      set_parallel(true)
      tween_cmd_3
      tween_cmd_4
      Then cmd1 will run to completion, then 2, 3, & 4 run in parallel. I had interval in position 1, so it "worked". It seems more intuitive if 1 &2 ran serially, then 3 &4 ran in parallel, but that's not what was implemented.

    • @michelveerman
      @michelveerman 2 месяца назад

      @@MuffinMan_Ken That's indeed quite strange, I understand the confusion. I guess it's still best to use chains, to make it more clear.