Author Topic: custom1 key trigger animation  (Read 2974 times)

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
custom1 key trigger animation
« on: January 02, 2017, 08:47:29 AM »
does anyone know how to script this?

when you press a key say custom1 ,,
to make it trigger an animation.

thanks



help a friend....

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 393
    • View Profile
Re: custom1 key trigger animation
« Reply #1 on: January 02, 2017, 09:15:38 AM »
this should do it:

Code: [Select]
fe.add_signal_handler("trigger_animation");
function trigger_animation( sig )
{
   if ( sig == "custom1" )
   {

      // insert code for what you want on cistom1 here
      // i.e. animate=true...

      return true;
   }

   return false;
}

jedione

  • Hero Member
  • *****
  • Posts: 1135
  • punktoe
    • View Profile
Re: custom1 key trigger animation
« Reply #2 on: January 02, 2017, 09:44:48 AM »
Thanks Raygun.......
---------------------------------------------------------------
Code: [Select]
class PopUpImage
{
        _my_image=null;

        constructor()
        {
                _my_image = fe.add_artwork( "snap", flx*0.200, fly*0.200, flw*0.100, flh*0.100 );
                _my_image.visible=false;
                fe.add_signal_handler( this, "on_signal" )
        }

        function on_signal( signal )
        {
                if ( signal == "custom1" )
                {
                        _my_image.visible=!_my_image.visible;
                        return true;
                }
                return false;
        }
}

local blah = PopUpImage();
this works great....
going to play with it and add animation to it...
help a friend....