Advertisement
Christophe3D

Tao3D: State machine

Dec 3rd, 2014
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.76 KB | None | 0 0
  1. Direction -> "horizontal"
  2. Movement  -> "sinus"
  3.  
  4. locally
  5.     adjust_position Direction
  6.     adjust_movement Movement
  7.     draw_shape_for Direction, Movement
  8.  
  9. button -1, 0, "Horizontal", Direction, "horizontal"
  10. button  0, 0, "Vertical",   Direction, "vertical"
  11. button  1, 0, "Changing",   Direction, "changing"
  12.  
  13. button -1, 1, "Sinus",      Movement, "sinus"
  14. button  0, 1, "Step",       Movement, "step"
  15. button  1, 1, "Wave",       Movement, "wave"
  16.  
  17.  
  18. adjust_position "horizontal" -> false
  19. adjust_position "vertical"   -> rotate_z 90
  20. adjust_position "changing"   -> rotate_z 20 * time
  21.  
  22. adjust_movement "sinus"      -> translate_x 200 * sin time
  23. adjust_movement "step"       -> translate_x 50 * seconds mod 500 - 250
  24. adjust_movement "wave"       -> translate 50 * time mod 500 - 250, 100 * sin time, 0
  25.  
  26.  
  27. draw_shape_for "horizontal", "sinus" ->
  28.     color "orange"
  29.     triangle 0, 0, 100, 100
  30.  
  31. draw_shape_for "horizontal", Mov ->
  32.     color "green"
  33.     circle 0, 0, 100
  34.  
  35. draw_shape_for Dir, "step" ->
  36.     color "blue"
  37.     star 0, 0, 100, 100, 5, 0.5
  38.  
  39. draw_shape_for Dir, Mov ->
  40.     color "red"
  41.     rounded_rectangle 0, 0, 320, 200, 200
  42.  
  43. button X, Y, Label, Variable, Value ->
  44.     active_widget
  45.         color "white"
  46.         linear_gradient 0, 0, 0, 32, 32, 32,
  47.             gradient_color 0%, "grey"
  48.             gradient_color 50%, "black"
  49.             gradient_color 100%, "darkblue"
  50.         rounded_rectangle X*120, Y*50, 100, 30, 30
  51.         on_click
  52.             Variable := Value
  53.             refresh 0
  54.            
  55.     text_box X*120, Y*50, 100, 30,
  56.         color (if Variable = Value then "yellow" else "white")
  57.         align_center
  58.         vertical_align_center
  59.         font "Ubuntu", 18
  60.         text Label
  61.  
  62. draw_selection X, Y, W, H -> false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement