diff --git a/front/src/components/Promo/main.vue b/front/src/components/Promo/main.vue index 40fa41a..85b9c03 100644 --- a/front/src/components/Promo/main.vue +++ b/front/src/components/Promo/main.vue @@ -5,8 +5,6 @@ import { TresCanvas, useRenderLoop } from '@tresjs/core'; import { vLightHelper } from '@tresjs/core' import { CameraControls, useGLTF, useProgress } from '@tresjs/cientos' -import sunset from '../../assets/promo/models/sunset.hdr' - const minPan = new Vector3(-10, 1, -5); const maxPan = new Vector3(5, 1, 5); const _v = new Vector3(); @@ -31,13 +29,30 @@ const controlsState = reactive({ const { hasFinishLoading, progress } = await useProgress() const { scene: spot_light } = await useGLTF('/Spot_light.glb') const spot_light_item = spot_light.children[0] +const spot_light_ref = ref() +const spot_light_target = ref() const target = new Object3D() -target.translateX(2) -target.translateY(-50) -console.log(target) +target.translateX(-10) +target.translateZ(10) +target.translateY(0) +const { onLoop } = useRenderLoop() +let direction = 0.05 +onLoop(({ elapsed }) => { + // target.translateY(-0.01) + if (spot_light_target.value) { + const px = spot_light_target.value.position.x + if (px >= 10) { + direction = -0.05 + } else if (px <= -10) { + direction = 0.05 + } + spot_light_target.value.translateX(direction) + } +}) +console.log(spot_light_target.value)