slice9.gui_script 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. local shape1 = vmath.vector3(660,576,0) -- < 1 >
  2. local shape2 = vmath.vector3(150,500,0)
  3. local shape3 = vmath.vector3(350,250,0)
  4. local function getshape(self) -- < 2 >
  5. local node = gui.get_node("slice_box")
  6. local function animate_size(node, shape) -- < 3 >
  7. gui.animate(node, "size", shape, gui.EASING_INOUTCUBIC, 1.75, 2.5, getshape, gui.PLAYBACK_ONCE_FORWARD)
  8. end
  9. if self.shape_number == 1 then
  10. animate_size(node, shape1)
  11. self.shape_number = 2
  12. elseif self.shape_number == 2 then
  13. animate_size(node, shape2)
  14. self.shape_number = 3
  15. else
  16. animate_size(node, shape3)
  17. self.shape_number = 1
  18. end
  19. end
  20. function init(self) -- < 4 >
  21. self.shape_number = 1
  22. getshape(self)
  23. end
  24. --[[
  25. 1.-Here we create 3 local vector3's representing 3 different sizes for use when animating
  26. the gui node size property.
  27. 2.-getshape() function gets our slice-9 gui node then an if statement is used to check
  28. the shape_number variable and animate_size is set accordingly and shape_number is
  29. changed for the next shape.
  30. 3.-The function animate_size() takes in the node and shape vector3 and uses them
  31. with gui.animate. Here we animate the "size" of the node and after the animation is
  32. complete getshape function is called again and a different shape "size" will be animated
  33. once again.
  34. 4.-In the initialize function we set self.shape_number to 1 and call getshape function to
  35. start the looping chained animation.
  36. --]]