trigger animation in Lua

Questions and information about using Lua scripting with Storyboard

Moderator: jamiev

trigger animation in Lua

Postby Ray » Wed Jan 25, 2017 11:17 am

Hi,

I am using gre.animation_trigger("animation_name") to play an animation, then have a layer on/off action for the following step. However, the animation is not shown in simulation cause the layer on/off action is triggered immediately before the animation is finished.

Is there any way to halt the system for 1 or 2 seconds? So the layer on/off can be triggered after the animation duration. Thank you.
Ray
 
Posts: 40
Joined: Wed Apr 06, 2016 3:32 pm

Re: trigger animation in Lua

Postby MikeMarchand » Wed Jan 25, 2017 11:40 am

Hi Ray,

If you want the layer on/off action to occur after the animation has finished then you could trigger the layer on/off action on the event 'gre.animate.complete.animation_name'.

Cheers,
Mike
MikeMarchand
 
Posts: 17
Joined: Wed Jan 21, 2015 3:33 pm

Re: trigger animation in Lua

Postby Ray » Wed Apr 12, 2017 9:20 am

Hi,

Follow the previous question. I prefer to use Lua script to create animation instead of taking screenshots. Now lets say I trigger an animation by

gre.animation_trigger("ani_name")

then I would like to have a screen change (gra.screen) after the animation is completed. Since I create the animation via Lua, there is no 'gre.animate.complete.ani_name' to select. How can I set up this action? Can I do it with Lua?
Ray
 
Posts: 40
Joined: Wed Apr 06, 2016 3:32 pm

Re: trigger animation in Lua

Postby MikeMarchand » Wed Apr 12, 2017 9:42 am

Hi Ray,

This can be accomplished in several different ways depending on how your animation was created.

If your animation was created in Designer, then there will be a "gre.animate.complete.ani_name"

If your animation was created in Lua then when you create your animation with gre.animation_create you can provide a callback function such as CBAniNameComplete which will be called when the animation is complete.
gre.animation_create(60, 1, CBAniNameComplete)

Good Luck!
Mike
Last edited by MikeMarchand on Wed Apr 12, 2017 10:54 am, edited 1 time in total.
MikeMarchand
 
Posts: 17
Joined: Wed Jan 21, 2015 3:33 pm

Re: trigger animation in Lua

Postby Ray » Wed Apr 12, 2017 10:47 am

Thanks for your prompt reply. Now I have:
Code: Select all
  local ani_name =gre.animation_create(10, 1, CBAniNameComplete)

  animation steps...bla..bla...bla

  gre.animation_trigger(ani_name)

So CBAniNameComplete (which has screen change action in it) shall be called after ani_name is completed. But in simulation, it seems like the screen change and the animation are triggered simultaneously. Please help.
Ray
 
Posts: 40
Joined: Wed Apr 06, 2016 3:32 pm

Re: trigger animation in Lua

Postby MikeMarchand » Wed Apr 12, 2017 10:58 am

Hi Ray,

If you send your application into support@cranksoftware.com we should be able to figure out the problem.

Another quick idea is to just add the layer visibility change as part of the animation.

Thanks,
Mike
MikeMarchand
 
Posts: 17
Joined: Wed Jan 21, 2015 3:33 pm

Re: trigger animation in Lua

Postby Ray » Wed Apr 12, 2017 11:05 am

Will send email to support. I know layer visibility can be tuned in animation, but I am trying to do screen change after animation is performed.
Ray
 
Posts: 40
Joined: Wed Apr 06, 2016 3:32 pm


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron