TweenGMS v2.0 Beta 2


A new beta for TweenGMS 2 is up!

=============================
 Changes Since Previous Beta
=============================

-Added duration continue swapping
TweenFire("-duration", [1,2], "~patrol", "x>", 10);

-Structs can now be used as valid tween targets
TweenFire(aStruct, EaseLinear, 0, true, 0, 1, "x>", 10);
** Make sure to delete any structs that need to be cleared right away.
** Tween callbacks could continue to be fired if struct not cleared from memory.
** Otherwise, manually destroy tween's as needed.

-Default TweenFire() calls can now use "ease" and "mode" strings
TweenFire(id, "ioSine", "patrol", true, 0, 1, "x>", 10);

-Default TweenFire() calls can now use advanced array parameters for MODE, DURATION, and DELAY
TweenFire(id, ["linear","oQuad"], ["patrol",2], true, [0,1,2], [1,2], "x>", 10);

-TweenAddCallback()/TweenAddCallbackUser() now support "event" strings
"finish", "@finish", etc...

-Default EASE functions are now internally converted to animation curves at startup for improved performance.
 However, to make use of them, you must either use "ease" strings or the new Curve* macros

TweenFire("$60", "~ioQuad", "x>", 10); // Optimised
TweenFire("$60", "~", CurveInOutQuad, "x>", 10); // Optimised
TweenFire("$60", "~", EaseInOutQuad, "x>", 10); // Not Optimised -- still calls ease function directly

-Added support for object property prefixes -- "obj_Player.x"
TweenFire("$60", "obj_Player.x", 0, 10);
guy = o_Guy;
TweenFire("$60", "guy.x", 0, 10);

-Fixed To/From support for structs when using TPTarget
TweenFire("$60", TPTarget(o_Player, "x>"), 10);
TweenFire("$60", TPTarget(aStruct, "y<"), 10);

-Change TGMS_PropertyMethod to TPFunc() and TPFuncX() -- Can also be directly used in a Tween function call
// Create 'myProp' property to be used in tween call
TPFunc("myProp", function(value,target){ target.myValue = value }, function(target){ return target.myValue });
TweenFire("$60", "myProp>", 10);

// Use TPFunc directly inside tween call
TweenFire("$60", TPFunc("abc", function(v,t){t.abc=v}), 0, 10);
// "abc" can still be resued in further calls
TweenFire(">>", "$60", "abc", 10, 100);

-Added ability to pass target id for inline tween callbacks by passing a struct as first array element with target value
TweenFire(..., "@finish", [{target:other}, Explode]);

-Added TWEEN_SELF so tweens can now reference themselves in functions/methods for event callbacks.
TweenFire("$60", "#patrol", "x>", 100, "@continue", function(){ TweenPause(TWEEN_SELF) });

-TweenMore() now works with 0,-1,-2,... indexing
TweenFire(...);
TweenMore(0, "ioSine", "patrol", true, 0, 1, "x>", 10);

-Animation curve channels can now be directly passed as an ease type without the need for EaseCurve()
TweenFire("$60", "~", aChannel", "x>", 20); 

-Added 'Tweens' selection target support
TweenPause({target: aStruct})

-EaseCurve() now takes an optional channel argument

-Added TGMS_ConvertEaseToCurve() for converting existing ease functions into animation curve channels

-Fixed issue where TweenEventClear() failed to actually clear the event... derp.

-TPStruct() has been merged into TPTarget()

-Fixed TweenIsPaused()


Files

TweenGMS v2.0 Beta 2 (Requires GMS 2.3.1) 77 kB
Nov 26, 2020

Get TweenGMS

Comments

Log in with itch.io to leave a comment.

Thanks for the Callback features !!

Although now I have a problem with a global variable.

Variable <unknown_object>.id(15, -2147483648) cannot be resolved.
 at gml_Script_TGMS_Variable_Get (line 93) - return variable_instance_get(_prefix.id, _postfix);
############################################################################################
gml_Script_TGMS_Variable_Get (line 93)
gml_Script_TGMS_TweenPreprocess (line 640) - _pData[i] = _pValue == global.TGMS_STR_AT ? _preOp*TGMS_Variable_Get(_target, _variable, _caller) : _preOp*TGMS_Variable_Get(_target, _pValue, _caller);
gml_Script_TGMS_Tween (line 528) - TGMS_TweenPreprocess(_t);
gml_Script_TweenFire (line 70) - return TGMS_Tween(TweenFire, _args, 0); // 3rd argument is not used here...
gml_Object_oFX_zoom_in_Create_0 (line 26) - Tween[0] = TweenFire("~inExpo", "$", 1, "global.Camara_zoom>", 1);

Try removing "global." and just write "Camara_zoom>"

Let me know if that works for you.

Currently, TweenGMS automatically finds global variables without using the 'global.' prefix. I might change this in the future to avoid confusion.

It worked! Thanks a lot!