summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTokage <tokage.it.lab@gmail.com>2021-04-25 05:47:03 +0900
committerSilc 'Tokage' Renew <tokage.it.lab@gmail.com>2021-10-09 18:08:43 +0900
commit372ba7666304805abe8641487c97899f9bdd97af (patch)
tree3a5d56b1fd80db923c08fa25c7c3d407b992c496 /doc
parente8c89b2b9158ce011ed5c1a913f55d38226c4a55 (diff)
implement ping-pong loop in animation
Co-authored-by: Chaosus <chaosus89@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/@GlobalScope.xml20
-rw-r--r--doc/classes/Animation.xml14
-rw-r--r--doc/classes/AnimationNode.xml1
-rw-r--r--doc/classes/AnimationNodeAnimation.xml9
-rw-r--r--doc/classes/AudioStreamSample.xml2
5 files changed, 43 insertions, 3 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 4b710d5f12..66c20b8426 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -525,6 +525,26 @@
[b]Warning:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for non-positive values of [code]value[/code] (in reality, 1 is the smallest integer power of 2).
</description>
</method>
+ <method name="pingpong">
+ <return type="float" />
+ <argument index="0" name="value" type="float" />
+ <argument index="1" name="length" type="float" />
+ <description>
+ Returns the [code]value[/code] wrapped between [code]0[/code] and the [code]length[/code]. If the limit is reached, the next value the function returned is decreased to the [code]0[/code] side or increased to the [code]length[/code] side (like a triangle wave). If [code]length[/code] is less than zero, it becomes positive.
+ [codeblock]
+ pingpong(-3.0, 3.0) # Returns 3
+ pingpong(-2.0, 3.0) # Returns 2
+ pingpong(-1.0, 3.0) # Returns 1
+ pingpong(0.0, 3.0) # Returns 0
+ pingpong(1.0, 3.0) # Returns 1
+ pingpong(2.0, 3.0) # Returns 2
+ pingpong(3.0, 3.0) # Returns 3
+ pingpong(4.0, 3.0) # Returns 2
+ pingpong(5.0, 3.0) # Returns 1
+ pingpong(6.0, 3.0) # Returns 0
+ [/codeblock]
+ </description>
+ </method>
<method name="posmod">
<return type="int" />
<argument index="0" name="x" type="int" />
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index d2ecbdde26..ca2c09d64d 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -481,6 +481,7 @@
<return type="Array" />
<argument index="0" name="track_idx" type="int" />
<argument index="1" name="time_sec" type="float" />
+ <argument index="2" name="is_backward" type="bool" default="false" />
<description>
Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quaternion]) and scale ([Vector3]).
</description>
@@ -523,8 +524,8 @@
The total length of the animation (in seconds).
[b]Note:[/b] Length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping.
</member>
- <member name="loop" type="bool" setter="set_loop" getter="has_loop" default="false">
- A flag indicating that the animation must loop. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
+ <member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="Animation.LoopMode" default="0">
+ Determines the behavior of both ends of the animation timeline during animation playback. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
</member>
<member name="step" type="float" setter="set_step" getter="get_step" default="0.1">
The animation step value.
@@ -577,5 +578,14 @@
<constant name="UPDATE_CAPTURE" value="3" enum="UpdateMode">
Same as linear interpolation, but also interpolates from the current value (i.e. dynamically at runtime) if the first key isn't at 0 seconds.
</constant>
+ <constant name="LOOP_NONE" value="0" enum="LoopMode">
+ At both ends of the animation, the animation will stop playing.
+ </constant>
+ <constant name="LOOP_LINEAR" value="1" enum="LoopMode">
+ At both ends of the animation, the animation will be repeated without changing the playback direction.
+ </constant>
+ <constant name="LOOP_PINGPONG" value="2" enum="LoopMode">
+ Repeats playback and reverse playback at both ends of the animation.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml
index 173ff43d2a..6bc44ea0a0 100644
--- a/doc/classes/AnimationNode.xml
+++ b/doc/classes/AnimationNode.xml
@@ -73,6 +73,7 @@
<argument index="2" name="delta" type="float" />
<argument index="3" name="seeked" type="bool" />
<argument index="4" name="blend" type="float" />
+ <argument index="5" name="pingponged" type="int" default="0" />
<description>
Blend an animation by [code]blend[/code] amount (name must be valid in the linked [AnimationPlayer]). A [code]time[/code] and [code]delta[/code] may be passed, as well as whether [code]seek[/code] happened.
</description>
diff --git a/doc/classes/AnimationNodeAnimation.xml b/doc/classes/AnimationNodeAnimation.xml
index 668a35226f..076e675007 100644
--- a/doc/classes/AnimationNodeAnimation.xml
+++ b/doc/classes/AnimationNodeAnimation.xml
@@ -15,5 +15,14 @@
<member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&amp;&quot;&quot;">
Animation to use as an output. It is one of the animations provided by [member AnimationTree.anim_player].
</member>
+ <member name="play_mode" type="int" setter="set_play_mode" getter="get_play_mode" enum="AnimationNodeAnimation.PlayMode" default="0">
+ Determines the playback direction of the animation.
+ </member>
</members>
+ <constants>
+ <constant name="PLAY_MODE_FORWARD" value="0" enum="PlayMode">
+ </constant>
+ <constant name="PLAY_MODE_BACKWARD" value="1" enum="PlayMode">
+ </constant>
+ </constants>
</class>
diff --git a/doc/classes/AudioStreamSample.xml b/doc/classes/AudioStreamSample.xml
index 7e1155d89b..df7b5ff1c7 100644
--- a/doc/classes/AudioStreamSample.xml
+++ b/doc/classes/AudioStreamSample.xml
@@ -61,7 +61,7 @@
<constant name="LOOP_FORWARD" value="1" enum="LoopMode">
Audio loops the data between [member loop_begin] and [member loop_end], playing forward only.
</constant>
- <constant name="LOOP_PING_PONG" value="2" enum="LoopMode">
+ <constant name="LOOP_PINGPONG" value="2" enum="LoopMode">
Audio loops the data between [member loop_begin] and [member loop_end], playing back and forth.
</constant>
<constant name="LOOP_BACKWARD" value="3" enum="LoopMode">