summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2022-04-28 20:23:41 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2022-04-28 21:19:01 +0800
commit6c01ef8f4ccecc6dc2f05dd7db999d1b7749ae71 (patch)
tree79c79a8f64d8024fe1db6bc0c5d88ea57740f3be /doc
parentd25c3aaaa708b7d8d001f56ca03ffe9bffeb8798 (diff)
Miscellaneous Tween fixes
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/Tween.xml14
-rw-r--r--doc/classes/Tweener.xml2
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml
index 2ec8bb287c..f9ec0d115d 100644
--- a/doc/classes/Tween.xml
+++ b/doc/classes/Tween.xml
@@ -76,7 +76,7 @@
<return type="float" />
<description>
Returns the total time in seconds the [Tween] has been animating (i.e. time since it started, not counting pauses etc.). The time is affected by [method set_speed_scale] and [method stop] will reset it to [code]0[/code].
- [b]Note:[/code] As it results from accumulating frame deltas, the time returned after the [Tween] has finished animating will be slightly greater than the actual [Tween] duration.
+ [b]Note:[/b] As it results from accumulating frame deltas, the time returned after the [Tween] has finished animating will be slightly greater than the actual [Tween] duration.
</description>
</method>
<method name="interpolate_value" qualifiers="static">
@@ -231,10 +231,10 @@
Example: creating an object that moves back and forth and jumps every few seconds.
[codeblock]
var tween = create_tween().set_loops()
- tween.tween_property("position:x", 200, 1).as_relative()
+ tween.tween_property($Sprite, "position:x", 200.0, 1).as_relative()
tween.tween_callback(jump)
tween.tween_interval(2)
- tween.tween_property("position:x", -200, 1).as_relative()
+ tween.tween_property($Sprite, "position:x", -200.0, 1).as_relative()
tween.tween_callback(jump)
tween.tween_interval(2)
[/codeblock]
@@ -274,16 +274,16 @@
Creates and appends a [PropertyTweener]. This method tweens a [code]property[/code] of an [code]object[/code] between an initial value and [code]final_val[/code] in a span of time equal to [code]duration[/code], in seconds. The initial value by default is a value at the time the tweening of the [PropertyTweener] start. For example:
[codeblock]
var tween = create_tween()
- tween.tween_property($Sprite, "position", Vector2(100, 200)
- tween.tween_property($Sprite, "position", Vector2(200, 300)
+ tween.tween_property($Sprite, "position", Vector2(100, 200), 1)
+ tween.tween_property($Sprite, "position", Vector2(200, 300), 1)
[/codeblock]
will move the sprite to position (100, 200) and then to (200, 300). If you use [method PropertyTweener.from] or [method PropertyTweener.from_current], the starting position will be overwritten by the given value instead. See other methods in [PropertyTweener] to see how the tweening can be tweaked further.
[b]Note:[/b] You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (eg. [code]position:x[/code]), where it would only apply to that particular component.
Example: moving object twice from the same position, with different transition types.
[codeblock]
var tween = create_tween()
- tween.tween_property($Sprite, "position", Vector2.RIGHT * 300).as_relative().set_trans(Tween.TRANS_SINE)
- tween.tween_property($Sprite, "position", Vector2.RIGHT * 300).as_relative().from_current().set_trans(Tween.TRANS_EXPO)
+ tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1).as_relative().set_trans(Tween.TRANS_SINE)
+ tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1).as_relative().from_current().set_trans(Tween.TRANS_EXPO)
[/codeblock]
</description>
</method>
diff --git a/doc/classes/Tweener.xml b/doc/classes/Tweener.xml
index 3392f9ee23..721ed4e13e 100644
--- a/doc/classes/Tweener.xml
+++ b/doc/classes/Tweener.xml
@@ -4,7 +4,7 @@
Abstract class for all Tweeners used by [Tween].
</brief_description>
<description>
- Tweeners are objects that perform a specific animating task, e.g. interpolating a property or calling a method at a given time. A [Tweener] can't be created manually, you need to use a dedicated method from [Tween] or [Node].
+ Tweeners are objects that perform a specific animating task, e.g. interpolating a property or calling a method at a given time. A [Tweener] can't be created manually, you need to use a dedicated method from [Tween].
</description>
<tutorials>
</tutorials>