how to use interpolate function?

cptongsgcptongsg Member Posts: 70
edited November -1 in Working with GS (Mac)
Hi, how to use Linear, ease in, easeout..... function?

Comments

  • netdzynrnetdzynr Member Posts: 296
    I recently just used it myself to replace a 'move to' behavior. Instead of using one 'move to', I used two 'interpolate' behaviors:
    interpolate self.Position.X to self.StartPointX
    interpolate self.Position.Y to self.StartPointY

    The amount of time is included in the behavior under Duration.

    Use the 'ease out' function when you want the actor to decelerate as it reaches its destination, or 'ease in' to make it accelerate (ease in/out does both during the move). In my case, using this behavior does seem to be more reliable (with 'move to' my actors sometimes overshot their destinations for some odd reason), and the big plus is movement is more organic looking with easing.

    Apparently you can also use interpolate for fades as well (fade the alpha of an actor from one value to another). Seems like a really useful behavior.
  • quantumsheepquantumsheep Member Posts: 8,188
    Yep - useful for fades!

    You can use it for quite a few things. Music Volume comes to mind...

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • cptongsgcptongsg Member Posts: 70
    Now I understand. Ha,that very useful function indeed. Just try the fade in out, so cool. Thanks alots guys! :)
  • SingleSparqSingleSparq Member Posts: 1,339
    How do you make an up and down motion with interpolate? I can set the self.Position.Y to self.StartPointY for one direction but how do you stop it and make it go back on a timed basis? (do you still have to use a timer?)
  • cptongsgcptongsg Member Posts: 70
    I make a simple demo http://gamesalad.com/game/play/49577
    hope it help.
  • quantumsheepquantumsheep Member Posts: 8,188
    Macview - if you worked this out, can you see if a simple pause function would work with the Interpolate behaviour?

    I've got a funny feeling it might not because it uses a timer, so a simple 'Pause on/off' switch may not work.

    Good luck!

    QS :)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • SingleSparqSingleSparq Member Posts: 1,339
    I haven't looked at using interoperate for this yet but am using a timer with change velocity and self.Motion.Linear Velocity.X - self.Motion.Linear Velocity.X change attribute to make the actor go back and forth (or up down with Y) - that pauses if I put an otherwise velocity=0 in the rule set.
Sign In or Register to comment.