Open MossFrog opened 2 years ago
This is much easier to achieve with the new Tween system in 4.0 (SceneTreeTween in 3.5). The linked example converts to:
var tween = create_tween.set_loops()
tween.tween_property($Sprite, "modulate:a", 0.0, 0.5)
tween.tween_property($Sprite, "modulate:a", 1.0, 0.5)
simple attribute to an already existing
It's not exactly simple to implement, but it's easy to workaround. Thus an addon could be better in this case.
I see, I have yet to get my hands dirty with Godot version 4.x and above due to the need of a more stable release version with better web support but I was unaware of this newer syntax thanks for the pointer! Is there any chance that these features will be back ported to 3.x? I assume it must be in the pipeline for 3.5 and above.
Cheers!
The Tweens were completely rewritten and they are no longer a Node, just something you use 100% in scripts. It replaces the old Tween node.
The feature was already backported to 3.5 as a new class called SceneTreeTween (similar to SceneTreeTimer, as they are somewhat similar in use). It's almost 100% compatible with the new system in 4.0. You can try it in the newest release candidate for 3.5.
Describe the project you are working on
3D HTML5 Hyper Casual and Casual Games.
Describe the problem or limitation you are having in your project
Creating tweens that repeat in reverse (yoyo) is extremely convoluted and requires creating a completion callback signal and re assigning new values as demonstrated in this example. https://godotengine.org/qa/24585/how-to-loop-a-tween-solved
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Either a simple yoyo flag for the built in tween node would render most of this excess code pointless. A further improvement could be the ability to assign negative timescales so that regardless of which state the tween is in it would attempt to revert back to its starting value.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
var tween = get_node("Tween") tween.interpolate_property($Node2D, "position", Vector2(0, 0), Vector2(100, 100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) tween.repeat = true tween.yoyo = true tween.start()
(The node will oscillate between the start and end values instead of jumping back to the start value on every repeat)
For inverse timescales var tween = get_node("Tween") tween.interpolate_property($Node2D, "position", Vector2(0, 0), Vector2(100, 100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT) tween.start() // After some theoretical timeout before the tween ends tween.timeScale = -1 // Tween reverses here halfway through completion
If this enhancement will not be used often, can it be worked around with a few lines of script?
https://godotengine.org/qa/24585/how-to-loop-a-tween-solved
Is the current workaround albeit slightly convoluted...
Is there a reason why this should be core and not an add-on in the asset library?
Due to it being a simple attribute to an already existing and functioning node it does not justify the creation of an extra extension.
Thanks!