Author Topic: Issue with animation  (Read 5016 times)

Mayki07

  • Full Member
  • ***
  • Posts: 31
    • View Profile
Issue with animation
« on: May 29, 2016, 05:24:38 AM »
I need to launch a third animation at the point where the second animation ends, can you advise me?

Code: [Select]
local slide = {
    property = "x",
    start = -800,
    end = dt.x,
tween = Tween.Sine,
    time = 5000}
animation.add( PropertyAnimation( dt, slide ) );
 
local slide2 = {
    property = "y",
    start = dt.y,
    end = 650,
    tween = Tween.Elastic,
    easing = Easing.Out,
    time = 8000,
    delay = 8000}
animation.add( PropertyAnimation( dt, slide2 ) );

local slide3 = {
    property = "x",
    start = ????
    end = 800,
    tween = Tween.Elastic,
    easing = Easing.In,
    time = 8000,
    delay = 18000}
animation.add( PropertyAnimation( dt, slide3 ) );

slide = first animation
slide2 = second animation
slide3 = third animation

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Issue with animation
« Reply #1 on: May 29, 2016, 11:13:51 AM »
Hi,

It may be helpful instead to use position instead of individual x/y changes. Try this:

Code: [Select]
fe.load_module("animate");
local dt = fe.add_artwork("wheel", 200, 300);
local slide = {
    property = "position",
    start = { x = -800, y = dt.y },
    end = { x = dt.x, y = dt.y },
    tween = Tween.Sine,
    time = 2500
}
animation.add( PropertyAnimation( dt, slide ) );

local slide2 = {
    property = "position",
    start = { x = dt.x, y = dt.y },
    end = { x = dt.x, y = 650 },
    tween = Tween.Elastic,
    easing = Easing.Out,
    time = 2500,
    delay = 2600}
animation.add( PropertyAnimation( dt, slide2 ) );

local slide3 = {
    property = "position",
    start = { x = dt.x, y = 650 }
    end = { x = 800, y = 650 },
    tween = Tween.Elastic,
    easing = Easing.In,
    time = 2500,
    delay = 5200}
animation.add( PropertyAnimation( dt, slide3 ) );

One thing to keep in mind is when you are creating the animation and specify object.x or object.y - that is the x and y at that point in time, not after an animation occurs, so it can get a little tricky :) I believe I also had some operator values like "+100" where it would add from the current position, but it may not always work properly. In the next animate version, I have ways to use "current" state to help with that.


Mayki07

  • Full Member
  • ***
  • Posts: 31
    • View Profile
Re: Issue with animation
« Reply #2 on: May 30, 2016, 01:29:33 PM »
It works absolutely beautifully, thank you very much ...  ;D