TextureSlider.re.ts 550 B

12345678910111213141516171819202122
  1. import * as RE from 'rogue-engine';
  2. import * as THREE from 'three'
  3. export default class TextureSlider extends RE.Component {
  4. @RE.props.vector2() offsetSpeed:THREE.Vector2 = new THREE.Vector2(0.1, 0.1)
  5. awake() {
  6. }
  7. start() {
  8. }
  9. update() {
  10. if((this.object3d as any).material.map) {
  11. (this.object3d as any).material.map.offset.x += this.offsetSpeed.x * RE.Runtime.deltaTime;
  12. (this.object3d as any).material.map.offset.y += this.offsetSpeed.y * RE.Runtime.deltaTime;
  13. }
  14. }
  15. }
  16. RE.registerComponent(TextureSlider);