mirror of
https://github.com/Floriansylvain/creative_coding_1.git
synced 2026-08-19 19:53:18 +02:00
Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import * as THREE from "three"
|
||||
import Experience from "./Experience.js"
|
||||
import { OrbitControls } from "three/examples/jsm/controls/OrbitControls.js"
|
||||
|
||||
export default class Camera {
|
||||
constructor() {
|
||||
this.experience = new Experience()
|
||||
this.sizes = this.experience.sizes
|
||||
this.scene = this.experience.scene
|
||||
this.canvas = this.experience.canvas
|
||||
|
||||
this.setInstance()
|
||||
// this.setControls()
|
||||
}
|
||||
|
||||
setInstance() {
|
||||
this.instance = new THREE.PerspectiveCamera(
|
||||
35,
|
||||
this.sizes.width / this.sizes.height,
|
||||
0.1,
|
||||
100
|
||||
)
|
||||
this.instance.position.set(0, 0, 20)
|
||||
|
||||
this.scene.add(this.instance)
|
||||
}
|
||||
|
||||
setControls() {
|
||||
this.controls = new OrbitControls(this.instance, this.canvas)
|
||||
this.controls.enableDamping = true
|
||||
}
|
||||
|
||||
resize() {
|
||||
this.instance.aspect = this.sizes.width / this.sizes.height
|
||||
this.instance.updateProjectionMatrix()
|
||||
}
|
||||
|
||||
update() {
|
||||
// this.controls.update()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user