Rotation.ts 384 B

1234567891011121314151617181920212223
  1. import { _decorator, Component, Node } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('Rotation')
  4. export class Rotation extends Component {
  5. rotation:number=0;
  6. @property({type:Number})
  7. spin:number=360;
  8. start() {
  9. }
  10. update(deltaTime: number) {
  11. this.rotation += deltaTime * this.spin;
  12. this.node.angle=this.rotation;
  13. }
  14. }