mirror of
https://github.com/anatolykopyl/vue-three-d-mockup.git
synced 2026-03-26 12:55:08 +00:00
Added a mouse follow animation
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Group } from 'three';
|
||||
import { Group, Vector3 } from 'three';
|
||||
|
||||
export default class MockupModel extends Group {
|
||||
constructor() {
|
||||
@@ -35,4 +35,12 @@ export default class MockupModel extends Group {
|
||||
rotateAnim() {
|
||||
this.rotation.y += 0.02;
|
||||
}
|
||||
|
||||
lookAtAnim(x, y, camera) {
|
||||
const target = new Vector3();
|
||||
target.x = x;
|
||||
target.y = y;
|
||||
target.z = camera.position.z;
|
||||
this.lookAt(target);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user