test43.nim 850 B

12345678910111213141516171819202122232425262728
  1. # --- Test 43. Use AnimationPlayer. --- #
  2. import nodesnim
  3. Window("AnimationPlayer")
  4. build:
  5. - Scene scene:
  6. - ColorRect rect:
  7. color: Color(0, 0, 0)
  8. call resize(100, 100)
  9. - ColorRect rect1:
  10. color: Color(0, 0, 0)
  11. call resize(100, 100)
  12. call move(0, 200)
  13. - AnimationPlayer animation:
  14. call addState(rect.color.r.addr, @[(tick: 0, value: 0.0), (tick: 200, value: 1.0)])
  15. call addState(rect.position.x.addr, @[(tick: 0, value: 0.0), (tick: 100, value: 250.0)])
  16. call setDuration(200)
  17. call play()
  18. mode: ANIMATION_NORMAL # Default animation mode.
  19. - AnimationPlayer animation1:
  20. call addState(rect1.position.x.addr, @[(tick: 0, value: 0.0), (tick: 100, value: 250.0)])
  21. call setDuration(200)
  22. call play()
  23. mode: ANIMATION_EASE
  24. addMainScene(scene)
  25. windowLaunch()