A library that compiles easing functions ported to Pawn, and it also includes an animation system for textdraws. This experimental idea gained fame through the "Hyaxe Roleplay" notifications, and I have finally decided to release a public version of this system.
- Download the latest version in releases
- Enter this line in your initial script
#include <pawn-easing-functions>
- Install YSF
// Position
PlayerText_MoveTo(playerid, PlayerText:textdraw, Float:x, Float:y, duration = 1000, ease);
PlayerText_MoveToX(playerid, PlayerText:textdraw, Float:x, duration = 1000, ease);
PlayerText_MoveToY(playerid, PlayerText:textdraw, Float:y, duration = 1000, ease);
// Size
PlayerText_MoveLetterSize(playerid, PlayerText:textdraw, Float:y, duration = 1000, ease);
PlayerText_MoveTextSize(playerid, PlayerText:textdraw, Float:x, duration = 1000, ease);
PlayerText_MoveSize(playerid, PlayerText:textdraw, Float:x, Float:y, duration = 1000, ease);
// Color
PlayerText_InterpolateColor(playerid, PlayerText:textdraw, color, duration = 1000, ease);
PlayerText_InterpolateBoxColor(playerid, PlayerText:textdraw, color, duration = 1000, ease);
PlayerText_InterpolateBGColor(playerid, PlayerText:textdraw, color, duration = 1000, ease);
// General
PlayerText_PlaceOnTop(playerid, PlayerText:textdraw);
PlayerText_StopMove(animator);
Animator_OnFinish(playerid, animator, type);
EASE_IN_SINE
EASE_OUT_SINE
EASE_IN_OUT_SINE
EASE_IN_QUAD
EASE_OUT_QUAD
EASE_IN_OUT_QUAD
EASE_IN_CUBIC
EASE_OUT_CUBIC
EASE_IN_OUT_CUBIC
EASE_IN_QUART
EASE_OUT_QUART
EASE_IN_OUT_QUART
EASE_IN_QUINT
EASE_OUT_QUINT
EASE_IN_OUT_QUINT
EASE_IN_EXPO
EASE_OUT_EXPO
EASE_IN_OUT_EXPO
EASE_IN_CIRC
EASE_OUT_CIRC
EASE_IN_OUT_CIRC
EASE_IN_BACK
EASE_OUT_BACK
EASE_IN_OUT_BACK
EASE_IN_ELASTIC
EASE_OUT_ELASTIC
EASE_IN_OUT_ELASTIC
EASE_IN_BOUNCE
EASE_OUT_BOUNCE
EASE_IN_OUT_BOUNCE
You can see what each of these features looks like here: https://easings.net/
cmd:move(playerid, const params[])
{
new Float:x, Float:y;
if (sscanf(params, "ff", x, y))
{
return SendClientMessage(playerid, 0xDADADAFF, "Usage: /move <x> <y>");
}
if (g_iAnimator != -1)
PlayerText_StopMove(g_iAnimator);
g_iAnimator = PlayerText_MoveTo(playerid, g_tdPlayerTextdraw, x, y, 1000, EASE_OUT_CUBIC);
return 1;
}
Internally there is a single timer that is responsible for updating all the animations so as not to saturate the timer server. This system may work poorly for users who have a very bad internet or a lot of packet loss, in any case you can globally change the refresh rate by overwriting the definition "ANIMATORS_UPDATE_RATE" which by default is set to 16 milliseconds.
ease_compressed.mp4
geforce_compressed.mp4
- Markski for lend a hand