1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

fix slider2

This commit is contained in:
Kevin Levron 2021-04-04 22:00:48 +02:00
parent 31cf5e99f2
commit 714b4776d7

View File

@ -1,5 +1,5 @@
<template> <template>
<Renderer ref="renderer" antialias resize mouse-move> <Renderer ref="renderer" antialias resize pointer>
<OrthographicCamera ref="camera" :position="{ z: 10 }" /> <OrthographicCamera ref="camera" :position="{ z: 10 }" />
<Scene ref="scene" /> <Scene ref="scene" />
</Renderer> </Renderer>
@ -85,8 +85,8 @@ export default defineComponent({
scene.add(this.image2.mesh); scene.add(this.image2.mesh);
}, },
animate() { animate() {
const { mouse } = this.three; const { positionN } = this.three.pointer;
this.center.copy(mouse).divideScalar(2).addScalar(0.5); this.center.copy(positionN).divideScalar(2).addScalar(0.5);
lerpv2(this.image1.uCenter.value, this.center, 0.1); lerpv2(this.image1.uCenter.value, this.center, 0.1);
lerpv2(this.image2.uCenter.value, this.center, 0.1); lerpv2(this.image2.uCenter.value, this.center, 0.1);