- Joined
- May 15, 2013
- Messages
- 2,248
- Reaction score
- 2,158
- First Language
- English
- Primarily Uses
- N/A
Easing Script
Edit: The completed script can now be found here: http://forums.rpgmakerweb.com/index.php?/topic/20714-ease-script-smooth-and-varied-movement/?p=197603
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 a "pop up" effect? That's what easing can do. Easing is using the powers of math to apply a modified movement curve to an object's attributes over a given period of time.
Demonstration
All of that is a bit boring, so have a look at this video instead. Please be aware that the choppiness is Fraps' fault; there's no extra performance hit on using the easing script from the regular move picture methods, so it moves silky smooth:
Does it work with multiple images, different durations and easing methods? But of course it does! The Move Picture extension hooks into the update method, and uses the Easing module algorithms instead of Ace's default, so it works just like Move Picture works by default, just with easing! Here's a super quick video I took of multiple pictures being moved with different durations and easing methods applied:
Moving pictures is just one use for the Easing Script. I'm making it modular, and scripters can use its easing class for anything, like moving projectiles, characters, fading pictures in exiting ways, etc. The script is modular, so you can add new easing algorithms easily, for example. It'll also be the first script I will release using the "Plugin Framework" setup, but don't worry; I'll make a standard script version too. It's a lot nicer to work with when you're using the plugin framework, however. Take a look at this neat folder structure:
Psst, scripters: Don't worry, I'll document it all properly...
How it works
To do what I did in the video above, all you have to do is set the easing method before you use a move picture command, by setting Game_Picture.easing to desired easing method in a script call. It's reset to default after the move command. You can also set the default easing method for all future move picture commands by using Game_Picture.easing_default instead. A picture is perhaps more descriptive:
Keep in mind that it works with all the Move Picture settings, like the duration. As you can see in the picture, I only call one Move Picture command; the movement is modified only based on the set easing method. I'm going to make a shorthand script call for setting the easing, so it won't be that much text needed when it's done.
Todo
While the script works for positioning of pictures, I haven't implemented it with alpha values yet, or tint. So that needs to be done. I'll also be adding more easing methods, like bounce, circular, curve and sine. In addition, I'll be implementing script calls for moving an event using easing and setting alpha values of events with easing. I'll then release it, as it will have a solid foundation for other scripters to use it and extend classes with it, and I'll probably make a few extensions myself which I've overlooked.
If you've got any questions, or have some ideas for this script, let me know
Have an awesome day!
WIP Demo
If you're feeling super adventurous, you can download the work in progress demo from the video and test it out for yourself. Does not contain the RTP, and includes an item popup picture from my game. Please don't use the picture in your game as-is, or you'll make me super sad -> o(╥﹏╥)o
Link to WIP demo file
Credit
- Galenmereth
- https://github.com/ai/easings.net For the wonderful elastic mathemagical algorithms
License
Free for commercial and non-commercial use. Credit is greatly appreciated but not required.
Edit: The completed script can now be found here: http://forums.rpgmakerweb.com/index.php?/topic/20714-ease-script-smooth-and-varied-movement/?p=197603
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 a "pop up" effect? That's what easing can do. Easing is using the powers of math to apply a modified movement curve to an object's attributes over a given period of time.
Demonstration
All of that is a bit boring, so have a look at this video instead. Please be aware that the choppiness is Fraps' fault; there's no extra performance hit on using the easing script from the regular move picture methods, so it moves silky smooth:
Edit: I've added the bounce ease method:
Moving pictures is just one use for the Easing Script. I'm making it modular, and scripters can use its easing class for anything, like moving projectiles, characters, fading pictures in exiting ways, etc. The script is modular, so you can add new easing algorithms easily, for example. It'll also be the first script I will release using the "Plugin Framework" setup, but don't worry; I'll make a standard script version too. It's a lot nicer to work with when you're using the plugin framework, however. Take a look at this neat folder structure:
How it works
To do what I did in the video above, all you have to do is set the easing method before you use a move picture command, by setting Game_Picture.easing to desired easing method in a script call. It's reset to default after the move command. You can also set the default easing method for all future move picture commands by using Game_Picture.easing_default instead. A picture is perhaps more descriptive:
Todo
While the script works for positioning of pictures, I haven't implemented it with alpha values yet, or tint. So that needs to be done. I'll also be adding more easing methods, like bounce, circular, curve and sine. In addition, I'll be implementing script calls for moving an event using easing and setting alpha values of events with easing. I'll then release it, as it will have a solid foundation for other scripters to use it and extend classes with it, and I'll probably make a few extensions myself which I've overlooked.
If you've got any questions, or have some ideas for this script, let me know
WIP Demo
If you're feeling super adventurous, you can download the work in progress demo from the video and test it out for yourself. Does not contain the RTP, and includes an item popup picture from my game. Please don't use the picture in your game as-is, or you'll make me super sad -> o(╥﹏╥)o
Link to WIP demo file
Credit
- Galenmereth
- https://github.com/ai/easings.net For the wonderful elastic mathemagical algorithms
License
Free for commercial and non-commercial use. Credit is greatly appreciated but not required.
Last edited by a moderator:
