Advertisement
snake5

sgs-ui: hover animator component

Sep 21st, 2014
407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function UI_HoverAnimator_Proc( event, com )
  2. {
  3.     if( event.type == EV_AddComponent )
  4.     {
  5.         foreach( k, v : com.data.state0 )
  6.             this.(k) = v;
  7.     }
  8.     else if( event.type == EV_MouseEnter )
  9.     {
  10.         this.stop(true).animate( com.data.state1, com.data.time );
  11.     }
  12.     else if( event.type == EV_MouseLeave )
  13.     {
  14.         this.stop(true).animate( com.data.state0, com.data.time );
  15.     }
  16. }
  17.  
  18. function UI_CreateHoverAnimator( ctrl, state0, state1, time )
  19. {
  20.     ctrl.addComponent( "hoveranimator", UI_HoverAnimator_Proc, { state0 = state0, state1 = state1, time = time } );
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement