mirror of
https://github.com/anatolykopyl/vue-three-d-mockup.git
synced 2026-03-26 12:55:08 +00:00
Fixed lookAt animation
This commit is contained in:
@@ -99,12 +99,9 @@ class MockupModel extends Group {
|
|||||||
|
|
||||||
lookAtAnim(dt, { x, y, z }) {
|
lookAtAnim(dt, { x, y, z }) {
|
||||||
const target = new Vector3();
|
const target = new Vector3();
|
||||||
// const boxTarget = new Vector3();
|
target.x = x - this.position.x;
|
||||||
// const boundingBox = new Box3().setFromObject(this);
|
target.y = y - this.position.y;
|
||||||
// boundingBox.getSize(boxTarget);
|
target.z = z - this.position.z;
|
||||||
target.x = x;
|
|
||||||
target.y = y;
|
|
||||||
target.z = z;
|
|
||||||
this.lookAt(target);
|
this.lookAt(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +303,7 @@ var script = {
|
|||||||
|
|
||||||
if (phones.length) {
|
if (phones.length) {
|
||||||
phones.forEach((phone) => {
|
phones.forEach((phone) => {
|
||||||
phone.animation(deltaTime, { x: mouseX, y: mouseY, z: camera.position.z });
|
phone.animation(deltaTime, { x: mouseX / 2, y: mouseY / 2, z: camera.position.z });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
z: -0.06,
|
z: -0.06,
|
||||||
}]"
|
}]"
|
||||||
/>
|
/>
|
||||||
|
<!-- <Mockup
|
||||||
|
class="mockup"
|
||||||
|
:screen="require('./assets/screen.png')"
|
||||||
|
/> -->
|
||||||
|
|
||||||
<video
|
<video
|
||||||
src="@/assets/screen.mp4"
|
src="@/assets/screen.mp4"
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ export default {
|
|||||||
|
|
||||||
if (phones.length) {
|
if (phones.length) {
|
||||||
phones.forEach((phone) => {
|
phones.forEach((phone) => {
|
||||||
phone.animation(deltaTime, { x: mouseX, y: mouseY, z: camera.position.z });
|
phone.animation(deltaTime, { x: mouseX / 2, y: mouseY / 2, z: camera.position.z });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -96,12 +96,9 @@ export default class MockupModel extends Group {
|
|||||||
|
|
||||||
lookAtAnim(dt, { x, y, z }) {
|
lookAtAnim(dt, { x, y, z }) {
|
||||||
const target = new Vector3();
|
const target = new Vector3();
|
||||||
// const boxTarget = new Vector3();
|
target.x = x - this.position.x;
|
||||||
// const boundingBox = new Box3().setFromObject(this);
|
target.y = y - this.position.y;
|
||||||
// boundingBox.getSize(boxTarget);
|
target.z = z - this.position.z;
|
||||||
target.x = x;
|
|
||||||
target.y = y;
|
|
||||||
target.z = z;
|
|
||||||
this.lookAt(target);
|
this.lookAt(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user