Author Topic: Need some help with the animate module  (Read 7738 times)

bundangdon

  • Sr. Member
  • ****
  • Posts: 212
    • View Profile
Need some help with the animate module
« on: April 30, 2016, 08:48:08 AM »
Hi everyone. Hopefully someone out there can help me with this (seemingly) simple but somewhat confusing issue. I've made my own modified layout, based on the original "concept" layout which can be seen below. However, I wanted to change the transition of the boxart from a fade to an animation, where the boxart slides/flies in from the left. I've added the "fe.load_module("animate");" line in the layout.nut file and in the text where the images are, it currently looks like this

local background = fe.add_image ( "images/back.png", 0, 0, 1920, 1080 );
background.alpha = 200;

// Snap
local surface = fe.add_surface( 256, 256 );
local artwork = FadeArt( "snap", 0, 0, 256, 256, surface );
artwork.trigger = Transition.EndNavigation;
artwork.preserve_aspect_ratio = true;
surface.set_pos( 120, 590, 500, 500 );

// Flyer
local surface = fe.add_surface( 500, 500 );
local artwork = FadeArt( "flyer", 0, 0, 500, 500, surface );
artwork.trigger = TRIGGER;
artwork.preserve_aspect_ratio = true;
surface.set_pos( 30, 0, 590, 590 );

Any help would be very very much appreciated  :D
« Last Edit: April 30, 2016, 08:54:41 AM by bundangdon »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 442
    • View Profile
Re: Need some help with the animate module
« Reply #1 on: May 01, 2016, 11:02:43 AM »
FadeArt is its own thing, which I think you know. If you use the animation module, you make animation "configs" to handle what you want to animate. Something like this should be close to what you want:

Code: [Select]
fe.load_module("animate");
local surface = fe.add_artwork("marquee", 50, 50, 400, 150);

local anim_leave = {
    when = Transition.ToNewSelection,   //when the animation will be triggered
    time = 500,  //how long the animation runs for
    property = "x",  //which property to animation
    start = 50,  //start value
    end = -450,  //end value
    wait = true  //wait the length of the animation before continuing (blocks UI, but will not change artwork until it finishes)
}

local anim_enter = {
    when = Transition.ToNewSelection,
    time = 500,
    property = "x",
    start = -450,
    end = 50,
    delay = 1000  //wait X ms to run this one
}

animation.add( PropertyAnimation( surface, anim_leave ) );
animation.add( PropertyAnimation( surface, anim_enter ) );

bundangdon

  • Sr. Member
  • ****
  • Posts: 212
    • View Profile
Re: Need some help with the animate module
« Reply #2 on: May 02, 2016, 01:10:25 AM »
FadeArt is its own thing, which I think you know. If you use the animation module, you make animation "configs" to handle what you want to animate. Something like this should be close to what you want:

Code: [Select]
fe.load_module("animate");
local surface = fe.add_artwork("marquee", 50, 50, 400, 150);

local anim_leave = {
    when = Transition.ToNewSelection,   //when the animation will be triggered
    time = 500,  //how long the animation runs for
    property = "x",  //which property to animation
    start = 50,  //start value
    end = -450,  //end value
    wait = true  //wait the length of the animation before continuing (blocks UI, but will not change artwork until it finishes)
}

local anim_enter = {
    when = Transition.ToNewSelection,
    time = 500,
    property = "x",
    start = -450,
    end = 50,
    delay = 1000  //wait X ms to run this one
}

animation.add( PropertyAnimation( surface, anim_leave ) );
animation.add( PropertyAnimation( surface, anim_enter ) );

Thank you so much!! That worked  :D

Mayki07

  • Full Member
  • ***
  • Posts: 31
    • View Profile
Re: Need some help with the animate module
« Reply #3 on: June 22, 2016, 01:26:26 PM »
Code: [Select]
when = Transition.ToNewSelection,   //when the animation will be triggered
I need to run animation only once, it's somehow set?