Ease Script - Animation framework

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Interesting script! This can be used as great addition for my battle system movement.

Am I allowed to modify this script and then redistribute it? Just in case if I found any compatibility issues with my basic modules
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
As long as you retain license and credits, go ahead :)
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
93
First Language
English
Primarily Uses
It's an error in Game_Interpreter, on whatever line eval is.

I'll see if I can cut out all my extra crap and pm it to you! 
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Awesome. If it turns out to be a compat problem, I'll be sure to release a public patch as well. But I might take some time, since I can only type with one hand atm :)
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
93
First Language
English
Primarily Uses
Awh, that's no good! Hope your other hand heals soon! PMing you in like 10 seconds
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
The documentation seems easy to understand. However, I still can't figure out how to implement this module in other object than Game_Picture and Game_Characterbase. Assumed I have a dummy object, it has x and y

class Dummy_Obj  attr_accessor :x  attr_accessor :y  def initialize(x,y)    @x = x    @y = y  endendHow the "call_on_update" should be?
Haven't tried yet but my guess will be something like this

def on_update(ease_obj)  container = ease_obj.target  @x = container[:x]  @y = container[:y]endAnd the next question. Assumed I copy all your script from github. Then I want to use bounce_in method. So, I just need set the easing option as :bounce_in?

{easing => :bounce_in}Sorry if I can't make it so clear
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
That looks correct TheoAllen. And yes, you can specify the easing method like that :)
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Thank you. It worked perfectly :)

This is the test script I wrote in editor

def updates  Graphics.update  Input.update  TDD::Ease.update  @spr.x = @dummy_obj.x  @spr.y = @dummy_obj.y  if Input.trigger?:)C)    @dummy_obj.ease_moveto(0, 0, 120)  endend class Dummy_Obj  attr_accessor :x  attr_accessor :y  attr_reader :easing    def initialize    @x = Graphics.width/2    @y = Graphics.height/2  end    def ease_moveto(x, y, frames, easing = :linear)    @easing = true    easing_container = {      :x => self.x,      :y => self.y    }    target_attributes = {      :x => x,      :y => y    }    TDD::Ease.to(easing_container, frames, target_attributes, {      :easing => easing,      :observers => [self],      :call_on_update => :on_update,      })  end    def on_update(ease_obj)    cont = ease_obj.target    self.x = cont[:x]    self.y = cont[:y]  end  end @dummy_obj = Dummy_Obj.new@spr = Sprite.new@spr.bitmap = Cache.battler("Captain", 0)updatesupdates while true
Btw, you mistyped something in TDD::Ease_Object

Look at your code at the github, line 292. 

It should be 'val' instead of 'value' I guess

@attributes_origin[attr] = val#valueAgain, thanks for sharing this ~
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Thanks for the heads up on that! I fixed it now :) I think the documentation and structure of the different modules could be improved a bit, so I'll do that when I get the chance. Glad to see people using it :D
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
93
First Language
English
Primarily Uses
Any guess on the demo? 
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Any guess on the demo? 
Yep! Found a bug in the script related to autorun events: it's been fixed and updated :) I saw you had some personal notes added to the script in your editor, so I've made a new version for you with notes intact here: http://pastebin.com/0ixGPnCA

Btw, when the shroom hits the player and turns on switch A for page 2, remember to also set Through checkbox to on on the event page: it won't be retained from Move Routes when switching pages, so the player will get stuck :)
 

Euphoria

Veteran
Veteran
Joined
Jun 27, 2013
Messages
378
Reaction score
93
First Language
English
Primarily Uses
Oh! Didn't know that, that will probably save me some trouble later on! And thank you for saving my notes and all and fixing the bug! :D

Edit: Just tried it and it works perfectly :) Thanks again for this awesome script!
 
Last edited by a moderator:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Just played with your module hours ago. And I made these.

An ease movement for sprite

#===============================================================================# Requires : TDD Ease Module#-------------------------------------------------------------------------------class Sprite  attr_reader :easing    def ease_move(x, y, frame, ease_method = :linear)    @easing = true    origins = {      :x => self.x,      :y => self.y    }    targets = {      :x => x,      :y => y    }    setup = {      :easing => ease_method,      :observers => [self],      :call_on_update => :on_ease_update,      :call_on_complete => :on_ease_complete    }    TDD::Ease.to(origins, frame, targets, setup)  end    def ease_slide(x,y,frame,ease_method = :linear)    x = self.x + x    y = self.y + y    ease_move(x,y,frame,ease_method)  end    def on_ease_update(ease_obj)    target = ease_obj.target    self.x = target[:x]    self.y = target[:y]  end    def on_ease_complete(ease_obj)    @easing = false  end  end
And a little fun, making my own easing method

I called it a half circle movement

module Easing  HALF_CIRCLE = "half_circle"  # t = Current time (frame)  # b = Start value  # c = Desired change in value  # d = Duration total (frames)  # Returns: Value modified by t  class << self    def half_circle(t,b,c,d)      radian = Math::pI * t/d.to_f      circ = Math.sin(radian)      return b + c*circ    end  end  end
It was named as "Jumping" at first. Because it will return to original value after go though the target value

I could see many potentials on this module :D
 
Last edited by a moderator:

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Hi, just want to say thank you very much. I learned how did you make the easing movement algorithm and I made this flawlessly



I'm sure I will credit that to you :D
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
That's awesome TheoAllen! Great use of the easing functionality that :D
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Teasing an addon that lets you implement easing on all Window animations, with different ones for each type of window. Extends Window_Base in a non-destructive way (turned off by default, has to be turned on specifically in each inheritor), this will not only allow it to be used on Ace's built-in Window classes, but also on your own, custom scripted ones.
 

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
Version has been bumped from 1.0.3 to 1.0.5

The following changes were made:

  • Bugfix: TDD Ease Object updated. :from now works as intended.
  • Optimization: Fixed attribute origin setting to remove method check, since that is done in the easing module already.
  • Optimization: Demo project updated, removed old move_route test map
  • Feature: 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.
Download here:

Github project: https://github.com/TorD/rgss3-ease-script

Direct text link: https://raw.githubusercontent.com/TorD/rgss3-ease-script/master/Data/Plugins/scripts.rb

Also, some bonus footage from progress on the window easing addon. It's coming along great, and you can now affect all the attributes separately with an easy configuration system, making for a lot of possibilities in window transitions. All of the following is just done by adding configuration to the config file to make the default Ace windows animate like this:



(The video is downsynced to 30fps by youtube, which doesn't look as smooth as it really is.)

For example, here is the config for the bouncing choice list you see in the main menu in the video above:

Code:
"Window_TitleCommand" => "Bounce In and Dip Out", # You can reference other config groups so you don't have to remake them for each window"Window_ChoiceList" => "Bounce In and Dip Out",   # Like above, this references the below setting group."Bounce In and Dip Out" => {  "Open" => {                     # There are two transitions for windows: when they open, and when they close    "Openness" => {      "Easing" => Easing::LINEAR, # This is the default easing, and can be omitted      "Method" => :to,            # This is the default method (eases from current window attributes to the ones given)      "Duration" => 1,            # 1 frame, so instantly in this case. This means the window will start out entirely "open" visually      "Attributes" => {        :openness  => 255      }    },    "Opacity" => {                # You can give these transition groups whatever name you want to make it easier to read for yourself      "Duration" => 10,      "Method" => :from,          # From means it will transition the attributes from the given values, to the window's current values      "Attributes" => {        :opacity => 0      }    },    "Position" => {      "Easing"  => Easing::BOUNCE_OUT,      "Method"    => :from,      "Duration"  => 40,      "Attributes" => {        :y => "-125"              # If you put numbers as strings, it's relative to the window's current attribute value. Think of it as "window.y - 125"      }    },    "Position 2" => {      "Easing" => Easing::EXPO_OUT, # I didn't want the bounce easing for the horizontal movement, so I made a separate group      "Method" => :from,      "Duration" => 40,      "Attributes" => {        :x => "-250"      }    }  },  "Close" => {    "Position" => {      "Easing" => Easing::BACK_IN,      "Method" => :to,      "Duration" => 15,      "Attributes" => {        :y => "+150"      }    }  }}
 
Last edited by a moderator:

Galenmereth

Retired
Veteran
Joined
May 15, 2013
Messages
2,248
Reaction score
2,158
First Language
English
Primarily Uses
N/A
That would be amazing indeed! I do own Luna, so I was planning to make a compatibility addon for the parts where it is required. Of course, settings for easing animation would still be separate from Luna's config (I don't want to edit Luna stuff more than absolutely necessary for a compatibility "patch"), but when the Window Easing is done and if it seems to fit well in, maybe we could get back to implementing an addon / compatibility script so that you can config easing right from Luna's menu configs? :)
 

Archeia

Level 99 Demi-fiend
Developer
Joined
Mar 1, 2012
Messages
15,141
Reaction score
15,473
First Language
Filipino
Primarily Uses
RMMZ
That would be amazing indeed! I do own Luna, so I was planning to make a compatibility addon for the parts where it is required. Of course, settings for easing animation would still be separate from Luna's config (I don't want to edit Luna stuff more than absolutely necessary for a compatibility "patch"), but when the Window Easing is done and if it seems to fit well in, maybe we could get back to implementing an addon / compatibility script so that you can config easing right from Luna's menu configs? :)
Oh oh! Can we talk more about it in PM? 
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top