Entity::getAnimCurrentTime: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Returns a float value representing animation's current playtime with respect to its total playtime. This value increasing in a range from [0 to 1] and wrap back to 0 when it reach 1.<br><br>Example:<br>0.000000 - mark the starting of animation.<br>0.500000 - mark the midpoint of the animation.<br>1.000000 - mark the end of animation.<br><br>Animations List : www.ls-multiplayer.com/dev/index.php?section=3
Returns a float value representing animation's current playtime with respect to its total playtime. This value increasing in a range from [0 to 1] and wrap back to 0 when it reach 1.<br><br>Example:<br>0.000000 - mark the starting of animation.<br>0.500000 - mark the midpoint of the animation.<br>1.000000 - mark the end of animation.
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">entity.getAnimCurrentTime(animDict, animName);</syntaxhighlight>
<syntaxhighlight lang="javascript">entity.getAnimCurrentTime(animDict, animName);</syntaxhighlight>
Line 9: Line 9:
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
// Example of stopping animation at the end and prevent loop.
 
let player = mp.players.local;
 
setInterval(() => {
if(player.getAnimCurrentTime(path, name) > 0.95){
player.stopAnimTask(path, name, 3.0);
clearInterval(this);
}
}, 1);
</syntaxhighlight>
</syntaxhighlight>
==See also==
==See also==
{{Entity_function_c}}
{{Entity_definition_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Latest revision as of 17:56, 1 May 2024

Returns a float value representing animation's current playtime with respect to its total playtime. This value increasing in a range from [0 to 1] and wrap back to 0 when it reach 1.

Example:
0.000000 - mark the starting of animation.
0.500000 - mark the midpoint of the animation.
1.000000 - mark the end of animation.

Syntax

entity.getAnimCurrentTime(animDict, animName);

Required Arguments

  • animDict: String
  • animName: String

Return value

  • float

Example

// Example of stopping animation at the end and prevent loop.

let player = mp.players.local;

setInterval(() => {
	if(player.getAnimCurrentTime(path, name) > 0.95){
		player.stopAnimTask(path, name, 3.0);
		clearInterval(this);
	}
}, 1);

See also