change vortex speed

This commit is contained in:
Adrien MALINGREY 2023-07-09 11:12:30 +02:00
parent 9877f21818
commit 4b357d5250
3 changed files with 37 additions and 19 deletions

@ -48,26 +48,40 @@ class TetraGUI extends GUI {
scene.vortex.darkCylinder.material.opacity = 0.1 scene.vortex.darkCylinder.material.opacity = 0.1
scene.vortex.colorFullCylinder.material.map = colorfullTexture scene.vortex.colorFullCylinder.material.map = colorfullTexture
scene.vortex.colorFullCylinder.material.opacity = 0.6 scene.vortex.colorFullCylinder.material.opacity = 0.6
scene.vortex.globalRotation = 0.028
scene.vortex.darkTextureRotation = 0.006
scene.vortex.darkMoveForward = 0.007
scene.vortex.colorFullTextureRotation = 0.006
scene.vortex.colorFullMoveForward = 0.02
scene.ambientLight.intensity = 0.1
scene.directionalLight.intensity = 15
} }
scene.ambientLight.intensity = 2
scene.directionalLight.intensity = 3
break break
case "Espace": case "Espace":
darkTexture = new THREE.TextureLoader(loadingManager).load("./images/dark.jpg", texture => { darkTexture = new THREE.TextureLoader(loadingManager).load("./images/dark.jpg", texture => {
texture.wrapS = THREE.RepeatWrapping texture.wrapS = THREE.RepeatWrapping
texture.wrapT = THREE.MirroredRepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping
texture.repeat.set(1, 1) texture.repeat.set(1, 2)
}) })
colorfullTexture = new THREE.TextureLoader(loadingManager).load("./images/colorfull.jpg", texture => { colorfullTexture = new THREE.TextureLoader(loadingManager).load("./images/colorfull.jpg", texture => {
texture.wrapS = THREE.RepeatWrapping texture.wrapS = THREE.RepeatWrapping
texture.wrapT = THREE.MirroredRepeatWrapping texture.wrapT = THREE.MirroredRepeatWrapping
texture.repeat.set(1, 1) texture.repeat.set(1, 2)
}) })
loadingManager.onLoad = function() { loadingManager.onLoad = function() {
scene.vortex.darkCylinder.material.map = darkTexture scene.vortex.darkCylinder.material.map = darkTexture
scene.vortex.darkCylinder.material.opacity = 0.2 scene.vortex.darkCylinder.material.opacity = 0.2
scene.vortex.colorFullCylinder.material.map = colorfullTexture scene.vortex.colorFullCylinder.material.map = colorfullTexture
scene.vortex.colorFullCylinder.material.opacity = 0.2 scene.vortex.colorFullCylinder.material.opacity = 0.2
scene.vortex.globalRotation = 0.028
scene.vortex.darkTextureRotation = 0.006
scene.vortex.darkMoveForward = 0.007
scene.vortex.colorFullTextureRotation = 0.006
scene.vortex.colorFullMoveForward = 0.02
scene.ambientLight.intensity = 2 scene.ambientLight.intensity = 2
scene.directionalLight.intensity = 3 scene.directionalLight.intensity = 3
} }

@ -1,21 +1,21 @@
import * as THREE from 'three' import * as THREE from 'three'
const GLOBAL_ROTATION = 0.028
const darkTextureRotation = 0.006
const darkMoveForward = 0.007
const colorFullTextureRotation = 0.006
const colorFullMoveForward = 0.02
class Vortex extends THREE.Group { class Vortex extends THREE.Group {
constructor(loadingManager) { constructor(loadingManager) {
super() super()
const commonCylinderGeometry = new THREE.CylinderGeometry(35, 35, 500, 12, 1, true) const commonCylinderGeometry = new THREE.CylinderGeometry(35, 35, 500, 12, 1, true)
this.globalRotation = 0.028
this.darkTextureRotation = 0.006
this.darkMoveForward = 0.007
this.colorFullTextureRotation = 0.006
this.colorFullMoveForward = 0.02
this.background = "Plasma" this.background = "Plasma"
this.darkCylinder = new THREE.Mesh( this.darkCylinder = new THREE.Mesh(
@ -52,13 +52,13 @@ class Vortex extends THREE.Group {
} }
update(delta) { update(delta) {
this.darkCylinder.rotation.y += GLOBAL_ROTATION * delta this.darkCylinder.rotation.y += this.globalRotation * delta
this.darkCylinder.material.map.offset.y += darkMoveForward * delta this.darkCylinder.material.map.offset.y += this.darkMoveForward * delta
this.darkCylinder.material.map.offset.x += darkTextureRotation * delta this.darkCylinder.material.map.offset.x += this.darkTextureRotation * delta
this.colorFullCylinder.rotation.y += GLOBAL_ROTATION * delta this.colorFullCylinder.rotation.y += this.globalRotation * delta
this.colorFullCylinder.material.map.offset.y += colorFullMoveForward * delta this.colorFullCylinder.material.map.offset.y += this.colorFullMoveForward * delta
this.colorFullCylinder.material.map.offset.x += colorFullTextureRotation * delta this.colorFullCylinder.material.map.offset.x += this.colorFullTextureRotation * delta
} }
} }

@ -118,6 +118,10 @@
} }
} }
body {
background-color: #222;
}
#loaddingCircle { #loaddingCircle {
margin: 0; margin: 0;
padding: 0; padding: 0;