Spinner.ts 648 B

123456789101112131415161718192021222324252627282930
  1. "atomic component";
  2. /**
  3. * Component that will rotate a node at a configurable speed.
  4. */
  5. export default class Spinner extends Atomic.JSComponent {
  6. /**
  7. * Fields witihin the inspectorFields object will be exposed to the editor
  8. */
  9. inspectorFields = {
  10. speed: 1.0
  11. };
  12. /**
  13. * The speed in which to turn the component
  14. * @type {number}
  15. */
  16. speed: number;
  17. /**
  18. * Update called every cycle with timeStep containing the delta between calls
  19. * @param {number} timeStep time since last call to update
  20. */
  21. update(timeStep) {
  22. this.node.yaw(timeStep * 75 * this.speed);
  23. }
  24. }