Ease Script - Animation framework

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
Ease Script - Animation framework 1.0.11

By: Galenmereth / Tor Damian Design
 
Introduction:
So what is "easing"? Have you tried using the Move Picture event command in Ace? You'll notice that, if you move the picture's position from one spot to another, the movement in between is linear - it moves from point A towards point B in X amount of frames in equal amounts each frame. A lot of the time this is fine, but what if you want to move the pictures quickly but with a little slowing down at the end, for example for a "pop up" effect? That's what easing can do. Easing is using math to apply a modified movement curve to an object's attributes over a given period of time. Math has a tendency to sound boring, doesn't it? Video time!
 
Examples
(The slight choppiness in the videos is due to the recording; the actual motion is silky smooth. Fullscreen helps, but you can check out the demo to see how it runs for you)
 
Video showing Move Picture and Tint Picture:

 
The video shows how a Move Picture event and a Tint Picture event are changed based on the selected easing method; the duration and settings in the events are the same, only the applied easing algorithm changes, to often drastic effect. Here's a screenshot of how easy it is to set an easing method:



By setting the Game_Picture.easing value to Easing::BOUNCE_OUT, all subsequent calls to Move Picture and Tint Picture are affected. You can set different easing methods for tint and move by adding another script call in between them, and there is no limit to how many pictures you can animate like this at any time. The script hooks into the update loop and replaces the default animation methods with the new easing one; as far as I can tell, there is no performance hit whatsoever.
 
Video showing Move Route calls: 
And the third and final video shows the script used within other scripts to easily animate Ace's default windows. This script will be an addon for this script very soon.
 
Features:
  • Works on both Move Picture and Tint Picture
  • Available Move Route script calls for easing events and characters. These calls areease_moveto(x, y, duration, easing_method)
  • ease_moveto_char(char_id, duration, easing_method)
  • ease_opacity(opacity, easing_method)
[*]7 groups of easing methods, each with 3 variations: In, out and in-out. Also includes an improved (performance vise) version of the default Linear ease method.
[*]Fully documented script - makes it very easy for scripters to use the Ease module for their own animations
[*]Fully modular script setup - like the above, this will help other scripters (and myself!) extend the functionality of the Ease module with new Easing algorithms, and using the Ease module in other scripts
[*]Virtually no performance hit as far as I have been able to tell, due to using mathematical algorithms to affect only the attributes of objects and hooking into the default update loop
How to use:
To install this script, open up your script editor and copy/paste this script to an open slot below Materials but above Main. Remember to save.

Using with Move Picture and Tint Picture

Before calling Move Picture and Tint Picture for a picture in the event editor, make a script call like this:Game_Picture.easing = Easing::ELASTIC_OUTThis will set the easing method to the ELASTIC_OUT algorithm. When you erase any picture using Erase Picture, the easing method is reset to the set default (Easing::LINEAR by default)
You can provide different easing methods for different events as well, by setting Game_Picture.easing between each call. It is remembered for each individual event call.

If you wish to set the default easing, you use the following in a script call:

Game_Picture.easing_default = :quad_in# :quad_in is shorthand for Easing::QUAD_IN; works for all easing methodsYou can look at the picture linked above in the introduction section for a visual demonstration of the script call.
 
Using with Move Routes
There are 3 Move Route script calls you can use. Below are the script calls and an explanation of the parameters. You place these within an event's Move Route by using the Script button.ease_moveto(x, y, duration, easing)#--------------------------------------------------------------------------# * Move To Position# Params:# =======# - x (integer or "string")# The x position to move to.# if integer then absolute X position on map# if string then relative to current position. Examples:# "0" -> 0 from current x pos# "-5" -> -5 from current x pos# "5" or "+5" -> +5 from current x pos# - y (integer or "string")# The y position to move to. Same rules as x param# - duration (integer)# How many frames the easing should last for# - easing :)symbol or "string")# The easing method to apply. Default is :linear#--------------------------------------------------------------------------ease_moveto_char(char, duration, easing)#--------------------------------------------------------------------------# * Move Character To Other Character# Params:# =======# - char (integer)# An integer noting the character to move to.# -1 -> player# 0 -> the current object calling this method# 1 and above -> event id on the current map# - duration (integer)# How many frames the easing should last for# - easing :)symbol or "string")# The easing method to apply. Default is :linear#--------------------------------------------------------------------------ease_opacity(opacity, duration, easing)#--------------------------------------------------------------------------# * Ease To Opacity# Params:# =======# - opacity (integer or "string")# Target opacity to ease to. If string, then relative to current opacity# value. See ease_moveto's x param for more on how to use relative# string values.# - duration (integer)# How many frames the easing should last for# - easing :)symbol or "string")# The easing method to apply. Default is :linear#--------------------------------------------------------------------------Here are two examples:

 
The above uses the relative position X and Y coordinates "0" and "+6" respectively, by setting them as strings. The duration is set as 90 frames, and the easing method is :bounce_out.
 

 
The above uses ease_moveto to move the entity to 11x, 0y, over 90 frames, using the easing method :circ_in. An opacity ease is chained in the same call (must be separated with ";") easing the opacity to 0 over 120 frames.
 
The following is a list of all available easing methods included by default.
You use them in calls like this:Game_Picture.easing = :back_in# orGame_Picture.easing = "back_in"# orGame_Picture.easing = Easing::BACK_IN# It's up to you what you prefer List of easing methods:

  • LINEAR (default, and like the default in VXAce)
  • BACK_IN
  • BACK_IN_OUT
  • BACK_OUT
  • BOUNCE_IN
  • BOUNCE_IN_OUT
  • BOUNCE_OUT
  • CIRC_IN
  • CIRC_IN_OUT
  • CIRC_OUT
  • CUBIC_IN
  • CUBIC_IN_OUT
  • CUBIC_OUT
  • ELASTIC_IN
  • ELASTIC_IN_OUT
  • ELASTIC_OUT
  • EXPO_IN
  • EXPO_IN_OUT
  • EXPO_OUT
  • QUAD_IN
  • QUAD_IN_OUT
  • QUAD_OUT
Demo
This is a download for the demo shown in the video

Script (direct link)
This is a direct link with the script; this is always up-to-date with the latest build
Side note: This script file is built using the Plugin Framework script, which you can take a look at in the demo file. There's a link to it in my signature.
 
Github
In case you're into github, or just want to see more details about ongoing development, check out the github repo: https://github.com/T...ss3-ease-script

FAQ
Q: Do I have to read the documentation before I ask a question?
A: Preferably, yes. Pretty please? :3

Credits and thanks
- Galenmereth / Tor Damian Design (that's me)
- Tsukihime: For the "Hime External Script Loader" script in the demo file
- https://github.com/ai/easings.net: For a few of the base algorithms. Free and open source.

License
Free for non-commercial and commercial use. Credit greatly appreciated but not required. Share script freely with everyone, but please retain this license unless you change the script completely. Thank you.

Author's notes
Planned future extensions:
  • Rotate implementation (I can't extend the Rotate Picture event command due to its structure, so I will have to make a script call for this)
  • Move Route implementation with script calls (will be nice for falling meteors, bouncing balls and smooth alpha fading) Already done!
Feel free to request an extension or modification, and please give me your feedback; it's greatly appreciated.
 
Changelog

  • 08/12/2013 - Restructured internal workings to use the TDD module namespace and utilize an Ease_Object instead of a hash for ease object workings. Updated OP with instructions for Move Route commands.
  • 05/16/2014 - Update with a new demonstration map and greater compatibility with other scripts.
  • 11/09/2014 - TDD Ease Object updated. :from now works as intended. Fixed attribute origin setting to remove method check, since that is done in the easing module already. Demo project updated.
  • 11/09/2014 - Added support for a delay option in options hash. This makes the easing wait x amount of frames before starting. Great for easily queueing up sequential menu list animations and other nice things.
  • 11/26/2014 - Added support to use non-Hash target objects. Also documented delay option in script source comments.
  • 12/21/2014 - Bumped to version 1.0.8. All changes will now be logged in the script proper, as well as the compiled source documentation found here: https://tdd-ease-script.s3.amazonaws.com/TDD/Ease.html
  • 03/24/2015 - Fixed ease_moveto_char errors reported by aramis_ix
  • 03/29/2015 - Fixed a bug in overwrite_other_easings and register_ease that caused overwrite to not work as advertised.
  • 03/30/2015 - Implemented :same functionality for overwriting other eases, only overwriting same attributes. Default (true) works as before.


Feeling generous?

If you would like to give me a small tip to help me spend even more time making and maintaining these free scripts, do consider supporting me on Gratipay. Any and all support will be greatly appreciated.
 
Last edited by a moderator:

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,442
Reaction score
10,855
First Language
English
Primarily Uses
RMVXA
How I wish this had been available when I started my current project.  I think I'm too far in to implement it now, but for the next one ....

thanks for this.
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
Depending on how your events are set up, it might not be much (if any) extra work to implement easing. But if it is, it might be better to just stick with what you've got like you say; it's tempting to redo things when something new comes along, but it's not always the best for the project's progress :)

Let me know if you need help implementing it, though. I'll answer project specific questions here, too, since others can learn from it as well.
 

KevinFrost

KevinFrost91
Veteran
Joined
Jul 19, 2013
Messages
36
Reaction score
6
First Language
English
Primarily Uses
RMMV
This is incredible! I've been trying to do this with just regular move picture commands, and I was able to get a choppy version of something like this, and it took a lot of commands. So this will help out a LOT! Thanks for the post! :D
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,442
Reaction score
10,855
First Language
English
Primarily Uses
RMVXA
Depending on how your events are set up, it might not be much (if any) extra work to implement easing. But if it is, it might be better to just stick with what you've got like you say; it's tempting to redo things when something new comes along, but it's not always the best for the project's progress :)

Let me know if you need help implementing it, though. I'll answer project specific questions here, too, since others can learn from it as well.
Thanks for the offer.  I've got up to about 10-11 hours of gameplay, so although it is indeed tempting, I think the sensible thing is to stick with what is.
 

senpoRiot

Professional Procrastinator
Veteran
Joined
Sep 6, 2012
Messages
291
Reaction score
36
First Language
Tagalog
Primarily Uses
ohoho...easing was never been this fun! :D saves a lot of time doing it manually. 
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
Happy to hear people are enjoying it!

I've been working on the move route extension today, and I'm pretty much done with the call that lets you move events. Here's a video demonstration:




The script calls for this are very simple. The one for the boulder falling down looks like this:



The first and second parameters are the X and Y positions; you can set these directly, or make them relative to the current position of the event by setting them as strings. "0" means "0 from current X coordinate", and "+6" is "+6 from current Y coordinate". The third parameter, 90, is the total duration, and :bounce_out is the shorthand call for the easing method. These work together with normal move route calls, and also make the entity play their walk animation (facing the correct way and all that) if you've got that selected on the event. You can call these in between normal move route events as well.

You may have noticed from the video that the flame kept moving to different positions when I touched it; since this is a script call, you can use other functions in the call, like rand(range). Here's the simple script call for the flame:



I want to add a few more script calls before I release the extension, like:

  • ease_alpha(alpha, duration) now done, but called ease_opacity
  • ease_move_to_event(event_id, duration) yep, also done, but called ease_moveto_char. Char can be -1 (player), 0 (itself) or any number from 1 upwards, which are the event id's on the current map.
I expect to be done very soon, but the day after tomorrow I'll be moving, so I might be a bit delayed. This has been a very fun script to make, so I might not be able to keep my hands off it :)
 
Last edited by a moderator:

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
So the script has been updated to version 1.0.1, which brings with it the Game_CharacterBase extension. This extension lets you use the following script calls in Move Routes:

  • ease_moveto(x, y, duration, easing_method)
  • ease_moveto_char(char_id, duration, easing_method)
  • ease_opacity(opacity, ease_method)
The demo file and script link in the OP have both been updated with these new features :) Documentation can be found in the OP, and in the script; search for "Game_CharacterBase" and scroll down to the methods. You can also look in the demo file.

I was going to make this a separate script as an "addon" (internally it is), but I think the functionality can be considered "core" enough. Tell me if you want separate script files.

Some technical babble follows about internal restructuring (interesting to scripters):

Internally, I have also restructured to include the TDD namespace, so that the engine extensions (and other scripts must) call TDD::Ease; this is to make it less likely for conflicts to arrise with other scripts that might use the name "Ease" for a module or class. I've also created a class called Ease_Object, that replaces the hash that was used earlier to store information about the easing. This makes for much cleaner code. This class is not yet fully documented (but it's pretty self explanatory and "simple" in structure); I will add detailed documentation to it much soon.
 
Last edited by a moderator:

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
This script (along with the demo project) can now be found on github here: https://github.com/TorD/rgss3-ease-script

The benefit of this is that you can easily fork the project and request a pull to the master branch if you find a bug and fix it. I can also provide experimental branches here in the future, without affecting the stable master branch. Github allows you to download the whole shebang as a .zip, so you don't have to use git to use it :) Of course I'll be keeping this thread up to date too, but the github repo will contain even more detailed information on progress and file updates.
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
I updated the Game_CharacterBase extension so that the camera follows the player if the player is affected by an easing Move Route script call. The following are the changes that have been made: https://github.com/TorD/rgss3-ease-script/commit/59bb11580a22d1355f26a8009c308df2cefc463f

This inspired me to look into making an easing camera movement extension, so that you can move the camera to a position or event/player character, and use all the easing methods with it. I think it should be a pretty easy affair :)
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
I've implemented a tiny update so that the script is now compatible with Victor Engine Light script. This small update removes the override of Game_CharacterBase's "update" method, which means it should now also be compatible with most scripts that touch this class.

The links in the first post are up-to-date with these latest changes.

Additionally, I've added a very simple demonstration map that shows off the various things you can do with the easing script:
 

Palsa

General of Aurda
Veteran
Joined
Dec 21, 2012
Messages
343
Reaction score
84
First Language
English
Primarily Uses
This looks like it will be extremely useful for visual novel type effects, outstanding script. :D
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
I believe it would, yes! I haven't had much time to improve on this script with more functionality, but what is here should help you out a lot already. If you've got any suggestions or questions, don't hesitate to voice them :)
 

C-C-C-Cashmere (old)

Resident Weirdo
Veteran
Joined
Mar 7, 2014
Messages
834
Reaction score
342
First Language
English
Primarily Uses
This is pretty amazing. I hope I can use it in my next game :)
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
92
First Language
English
Primarily Uses
I'm getting an error when trying to move to the character (with through on), it's giving me a no method error for nil class because of 

@interpreter.get_character(char)Idk why... I don't think any scripts would be messing with something like this.

Edit: It happens when trying to move it to an event as well.
 
Last edited by a moderator:

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
Can you test in a project with no other scripts but the easing scripts? And what scripts -- if any -- are you using in your current project aside from these?
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
92
First Language
English
Primarily Uses
Oh, god I have like 120 scripts currently.

Talk about spending a lot of time fixing compatibility...

I'm thinking the only ones that might effect it would be move route scripts? But I don't know. The moveto, works fine, haven't tried the opacity fade, it's just giving me an error and not recognizing the events when I enter their numbers.
 

Galenmereth

I thought what I'd do was
Veteran
Joined
May 15, 2013
Messages
2,207
Reaction score
1,923
First Language
English
Primarily Uses
RMMV
What is the exact error msg btw? Any line numbers?

You could also send me your project file (no RTP required) and I can figure it out for you. Just PM me :)
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Kes wrote on Chef's profile.
I have deleted your profile post as our Rules are quite clear that you may not use them to advertise non-RM products, nor may you give a link to anything that solicits payment for you.
140 Thousand words, take one down, toss it around, discover I hate the direction I went and decide to start a complete rewrite.
I like being a butt to people.
Dirtnap wrote on Tyler Warren's profile.
Hi Tyler,

My name is Sean, I am the owner of an indie studio, and I am looking to get some paid art work done. I am working with MV, but our programmer will be heavily modifying it.

If you are interested, or would like to hear more, I can provide my personal e-mail address.

S.G.
The stream will be live shortly with some more Witcher 3! Feel free to drop by~

Forum statistics

Threads
93,601
Messages
913,832
Members
123,149
Latest member
BwadeZ
Top