TweenGMS
*ATTENTION*
TweenGMS and TweenGMX are no longer supported here on Itch.io.
Instead, please find the latest versions on the GameMaker Marketplace:
TweenGMX
TweenGMS Legacy
Come join the TweenGMS Discord Server!
https://discord.gg/CW45d5bAhj
TweenGMS is a feature-rich tweening engine for GameMaker which is both flexible and easy-to-use.
With years of development, it offers essential and advanced features powered by an optimised codebase.
Boost the look of your games by tweening movement, rotation, scale, paths, and much more!
Not familiar with tweening? See this video.
Or, you can also check out the TweenGMS video tutorials.
[Features]
- Fire-and-forget tweening
- Step and seconds(delta) timing
- Time scale control (global and per-tween)
- Play modes (once,bounce,patrol,loop,repeat)
- State control (pause,resume,stop,finish,reverse)
- Automatic memory and persistence management
- Advanced callback system
- Custom variable easing
- Path resource tweening
- Data structure support
- Delayed tweens
- Control groups
- Heavily optimised
- Supports all platforms
- And more...
TweenGMS can be seen in action with Russian Subway Dogs
Please note:
TweenGMS v1.20 is the latest stable build for GM 2022.
TweenGMX will be replacing TweenGMS with many new features.
TweenGMS v1.0.3 is the last version supporting GMS 1.4
Download
This tool is currently unavailable
Development log
- TweenGMX Beta 14 + Moving to GM MarketplaceJul 24, 2022
- TweenGMX Beta 13 (Essential Runtime Fix)Jun 24, 2022
- TweenGMX and Beta 12Apr 18, 2022
- TweenGMS 1.20 "Silent" UpdateApr 02, 2022
- TweenGMS v1.20Mar 30, 2022
- TweenGMS Pro v1.12 (copy-on-write fix)Feb 25, 2022
- TweenGMS 2 Beta 11Feb 07, 2022
- TweenGMS Pro v1.11Jan 01, 2022
Comments
Log in with itch.io to leave a comment.
hello Stephen thank you for your tool, i was wondering how you managed to make the frog on your example and the ghost, could you share their tweens please ?
Thank you stephen
Hey, David!
I believe you meant this for Scribble. I know, because I came across the same issue in Scribble. 😀
You'll want to contact Juju Adams about that one. :)
Take care!
Hi Stephen, I really really like this module but I have one quick(?) question for you.
At present the tweens are based on time which the downside that some objects move faster than others depending on the distance you're tweening them. What I would like to know is if it is possible to tween based on a max speed? So if you have two instances of the same object but are moving them different distances then one will arrive before the other. I don't know if I've explained it very well, but hopefully you'll understand what I'm asking.
Hey!
I believe what you are looking for is in the TweenGMS 2 beta. Passing a duration as an array [100] will tell the tween to use a normalized duration.
TweenFire(id, "io", 0, true, 0, [100], "x", 0, 500);
That would have x update at 100 pixels per second. So, the example above would have an actual duration of 5 seconds.
However, using step timing will have it update a certain amount per step.
TweenFire(id, "io", 0, false, 0, [5], "x", 0, 500);
The example above would move x by 5 pixels (on average) per each step/frame.
If possible, I'd take a look at the beta and see if this infact is what you are looking for.
-Stephen
Excellent. I'll give that a look and report back.
De los mejores extensiones y por lejos, gran trabajo 8bitWarrior ¡¡Esperare pacientemente la nueva version con soporte para la 2.3!!
Glad you have found it helpful :)
Replied on Twitter. Posting here just in case Twitter doesn't notify you.
Hello, I was able to find the cause and resolve my error. No surprise, it was my fault again! But I did figure out some pretty interesting stuff that may be useful to you so i've replied in detail to your twitter message. Thanks for the stellar support and if there's anything I can do to help you out don't hesitate to ask!
create:
tweenScale2 = TweenCreate(id, EaseInOutQuad, TWEEN_MODE_BOUNCE, true, 0.0, 1.0,
"image_xscale", image_xscale, 2,
"image_yscale", image_yscale, 2);
mouse left:
TweenPlay(tweenScale2);
Working один раз, и больше метод проигрываться не хочет.
ПОчему?
Я сейчас расследую. Я дам вам знать, что я нашел.
Спасибо, что обратили на это мое внимание. Я нашел проблему. Я планирую в ближайшее время выпустить обновление, чтобы исправить это. А пока вы можете исправить это сами, сделав следующее ...
1) Открываем скрипт TGMS_TweenPlay
2) Найдите строку 25 с _t [@ TWEEN.TIME] = 0;
3) Ниже строки 25 добавить ...
_t [@ TWEEN.DIRECTION] = 1;
_t [@ TWEEN.TIME_SCALE] = abs (_t [TWEEN.TIME_SCALE]);
Это должно решить проблему.
Позвольте мне знать, если это помогает! :)
TweenGMS v1.0.7 now includes a fix :)
Hi, thank you for your wonderful scripts!
I used TweenGMS without any issue with GMS 2.2.5 for several HTML5 projects and it worked fine. However in GMS 2.3 all i get in the browser is a white page. The debug console trows me a bunch of errors about "Error calling extension initialisation function: gml_Script_TGMS_Ext_Init”.
How can I provide you a full report about this error?
Hey, Alberto.
There is a known issue with the latest 2.3 build which affects the passing and calling of referenced functions/methods. This is something which TweenGMS has relied upon heavily. Ideally, Yoyo Games will have a fix for this soon.
FrostyCat has made mention of this over on the GameMaker Community forum: https://forum.yoyogames.com/index.php?threads/gms-2-3-0-beta-announcement.74346/...
Thank you. This 2.3 release seems really too immature.
Hello again, Thanks for the help last time! I am working on a very complex project and we're getting a rough error. I know it's our fault, but trying to track it down. Do you have any idea what might be the most common cause of something like this? Maybe you've seen it before and know what type of common mistake might trigger this?
FATAL ERROR in action number 1 of Step Event1 for object obj_SharedTweener: undefined value at gml_Script_TGMS_ExecuteEvent (line 16) - repeat(_event[| 0] * (ds_list_size(_event)-1)) -------------------------------------------------------------------------------------------- stack frame is gml_Script_TGMS_ExecuteEvent (line 16) called from - gml_Object_obj_SharedTweener_Step_1 (line 113) - TGMS_ExecuteEvent(_t[TWEEN.EVENTS], TWEEN_EV_FINISH); // Execute FINISH event
Also; does TweenGMS ever put arrays into any list that it uses? That might explain what's going on? Maybe something like an array like this? [-2,0,0,1] Do you recognize that structure or can tell me where something like that might come from?
This error seems to be related to the FINISH EVENT callback.
It appears to be reporting that "_event" is not defined, when it should be. This variable is a list with data about the FINISH callback. _event[| 0] holds a true/false value depending on if the event is enabled/disabled.
It is hard for me to know for sure why this is happening. Which version of TweenGMS are you using? (v1.0.6?)
Shoot me a private DM on Twitter @8BitWarrior (DMs are open) and I can give you my email address for responding with more details.
Error was my fault, thanks.
Is there any way to change the beginning and end reference values of a tween while still compensating for its current value
so for instance, say I have a EaseInOutSine patrol tween and it's going from 25 - 35, and I want to smoothly change it so that it is going from 15-40, BUT, at the particular frame where I want it to change, the value is at 27 and on its way up. Is there some way to have it stay at '27', and progress to the other min/max values of the new tween without 'teleporting' at the moment of the swap?
I know what you are describing. I will need to give this some thought. I might have a solution in mind, but I want to try it out before suggesting it.
Let me get back to you. :)
Great, thank you so much!
So! I'm not sure if this is going to work for you or not, but I have found one possible solution. It involves firing 2 tweens at the same time and effectively switching between them by lerping to the value of the desired tween. It's a bit funky, but it might do what you need it to. Do note though, that both tweens should use the same duration for this trick to work best. Here is a link to an example project. The code is in obj_Example. When running the example, click the left mouse button to toggle between the 2 tweens.
Let me know if this helps at all.
http://www.stephenloney.com/_/Share/LerpingTweens.yyz
Ah this is super cool but unfortunately doesn't solve my issue. As the tweens in question woud have different durations...
I might know of a solution for differing durations. I may have something later this week to throw past you if it works out.
Hi 8BitWarior. I noticed a possible issue. I would like to run two tweens on the same object at the same time. The mode of a first is TWEEN_MODE_BOUNCE and the mode of the second is TWEEN_MODE_ONCE. So basically what I want is to rotate the object and also scale it up at the beginning and scale it back down at the end. The bounce one is not working, it uses the once mode. Following is my code:
TweenFire(
self, // Target
EaseLinear, // Ease function
TWEEN_MODE_BOUNCE, // Tween mode
true, // Use delta time?
0.0, // Delay
0.3, // Duration
"image_scale", // Property
image_xscale, // From value
image_xscale * 0.9 // To value
);
TweenFire(
self, // Target
EaseLinear, // Ease function
TWEEN_MODE_ONCE, // Tween mode
true, // Use delta time?
0.0, // Delay
0.3, // Duration
"image_angle", // Property
image_angle, // From value
image_angle + _angle // To value
);
I'll need to see if I can reproduce this issue. To confirm, are you using the latest version of TweenGMS?
I have tested out the supplied code.
In version 1.0.3 of TweenGMS in GameMaker Studio 2, it appears to be working as it should be.
Which version of GameMaker and which version of TGMS are you using?
Hi 8BitWarrior. Thank you for sharing this library. May I ask you a question. Is there a way how to tween a group of tweens and then invoke a callback when all of them finished tweening? So far I managed to achieve that by having a count of individual tweens then calling a finished callback on each tween and then when the count of callback invokations reaches the total count, then execute the final finished code. But to me it doesn't look very elegant. Please advice. Thank you.
Hmm. Out-of-the-box, there is no function for this. I would need to know what you are doing to better help build a simpler solution.
I will give it some thought.
I want to click an object and then move couple of other objects and when all of them finished moving, I want to set some flag. Each and every object moves and rotates to different position.
Depending on how things are timed, you could add a callback to just the last-to-finish tween. Callbacks might be the best solution for now. There might be easier ways to help achieve this in the future.
First I would like to thank for the asset. I have a question though. Would it be possible to control the change of the variable on each step? So basically I would like to give to the tweener the time/steps and ease control but keep the changing of the variable, for example in a tween step callback script. That script would accept start and end position, duration and progress of a particular tween execution and would set/return the tweening variable value for the particular step (similarly like the To method in DOTween library for unity, if you are familiar).
Thank you
Darius
Hey! I am having some trouble understanding exactly what you need. Would it be possible to show an example of code from Unity and the DOTween library, and I could try to translate it to GameMaker and TweenGMS :)
Hi 8BitWarrior. I want to achieve the following. I have an object with triangle shape sprite and I need to rotate an instance of it around any of the vertices depending on the user action. I can not use sprite origin to do that, by dynamically changing the sprite origin and then rotating the sprite, for it will affect the origins of all other instances of the object. But I want to animate that rotation and this means that I need to calculate the instance position and rotation for each step of the move. For that I want the tweener to call my script 30 or 60 times and I will move the instance in code rather than allowing it to lerp between start and end value and move the instance automatically. This i because my trajectory is not a line, but a curve. My script would accept the instance id, start and end value and the progress value, from them I can calculate the exact position and rotation.
This is easily achievable by DOTWeen library in Unity (http://dotween.demigiant.com/getstarted.php):
Please see the following script (C#):
public static Tween Rotate(Transform target, Vector3 rotationPoint, float angle, float duration)
{
var angleRotated = 0f;
return DOTween.To(
() => angleRotated,
newAngle =>
{
// This is a custom function which calculates the position and then moves the object to it
GameObjectHelpers.RotateAroundLocal(target, rotationPoint, newAngle - angleRotated);
angleRotated = newAngle;
},
angle,
duration
);
}
Thanks in advance
Hey, Darius.
Sorry for the SUPER late reply! Did you ever find a solution to this, or can I still be of any help?
Let me know :)
-Stephen
hello my asset will be sold, as I understand it, I can’t use your twin system as part of an asset or can I remove most of the code leaving only the piece I need so that it works?
You can include it.
I have deemed TweenGMS open source, so use it as you like! ^.^
Thanks you! However, I will definitely buy it for money when I can afford it!
hey, how do you change the fps of the tween?
Hi! I am not 100% sure what you are wanting, but I have a couple of things to try. First you could change the time scale of a tween by using TweenSet()...
TweenSet(tweenID, "time_scale", 0.5);
You could also change the time scale for the whole tweening system like such...
TweenSystemSet("time_scale", 0.5);
Lastly, you can change the update interval of of the tweening system...
TweenSystemSet("update_interval", 2);
The default interval is 1 which updates the system every step. But if you set it to 2, it would update every 2 steps. This means that if your game ran at 60fps, then the tweening engine would run at roughly 30fps.
I hope this helps. Follow up and let me know if any of this works for your needs :)
-Stephen