vortex
This commit is contained in:
parent
a7eff47b97
commit
7e245011ef
@ -33,30 +33,27 @@ class TetraGUI extends GUI {
|
|||||||
let darkTexture, colorfullTexture
|
let darkTexture, colorfullTexture
|
||||||
switch (background) {
|
switch (background) {
|
||||||
case "Plasma":
|
case "Plasma":
|
||||||
darkTexture = new THREE.TextureLoader(loadingManager).load("./images/plasma.jpg", texture => {
|
darkTexture = new THREE.TextureLoader(loadingManager).load("./images/plasma2.jpg", texture => {
|
||||||
texture.wrapS = THREE.RepeatWrapping
|
|
||||||
texture.wrapT = THREE.MirroredRepeatWrapping
|
|
||||||
texture.repeat.set(1, 1)
|
|
||||||
})
|
|
||||||
colorfullTexture = new THREE.TextureLoader(loadingManager).load("./images/plasma2.jpg", texture => {
|
|
||||||
texture.wrapS = THREE.RepeatWrapping
|
texture.wrapS = THREE.RepeatWrapping
|
||||||
texture.wrapT = THREE.MirroredRepeatWrapping
|
texture.wrapT = THREE.MirroredRepeatWrapping
|
||||||
texture.repeat.set(2, 1)
|
texture.repeat.set(2, 1)
|
||||||
})
|
})
|
||||||
|
colorfullTexture = new THREE.TextureLoader(loadingManager).load("./images/plasma.jpg", texture => {
|
||||||
|
texture.wrapS = THREE.RepeatWrapping
|
||||||
|
texture.wrapT = THREE.MirroredRepeatWrapping
|
||||||
|
texture.repeat.set(1, 1)
|
||||||
|
})
|
||||||
loadingManager.onLoad = function() {
|
loadingManager.onLoad = function() {
|
||||||
scene.vortex.darkCylinder.material.map = darkTexture
|
scene.vortex.darkCylinder.material.map = darkTexture
|
||||||
scene.vortex.darkCylinder.material.opacity = 0.1
|
scene.vortex.darkCylinder.material.opacity = 0.75
|
||||||
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.075
|
||||||
|
|
||||||
scene.vortex.globalRotation = 0.028
|
scene.vortex.globalRotation = 0.028
|
||||||
scene.vortex.darkTextureRotation = 0.006
|
scene.vortex.darkTextureRotation = 0.005
|
||||||
scene.vortex.darkMoveForward = 0.007
|
scene.vortex.darkMoveForward = 0.012
|
||||||
scene.vortex.colorFullTextureRotation = 0.006
|
scene.vortex.colorFullTextureRotation = 0.006
|
||||||
scene.vortex.colorFullMoveForward = 0.02
|
scene.vortex.colorFullMoveForward = 0.016
|
||||||
|
|
||||||
scene.ambientLight.intensity = 0.1
|
|
||||||
scene.directionalLight.intensity = 15
|
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "Espace":
|
case "Espace":
|
||||||
@ -113,9 +110,9 @@ class TetraGUI extends GUI {
|
|||||||
|
|
||||||
this.settings.volume = this.settings.addFolder("Volume").open()
|
this.settings.volume = this.settings.addFolder("Volume").open()
|
||||||
this.settings.volume.add(settings,"musicVolume").name("Musique").min(0).max(100).step(1).onChange(volume => {
|
this.settings.volume.add(settings,"musicVolume").name("Musique").min(0).max(100).step(1).onChange(volume => {
|
||||||
if (volume) {
|
scene.music.setVolume(volume/100)
|
||||||
scene.music.setVolume(volume/100)
|
if (game.playing) {
|
||||||
if (game.playing) scene.music.play()
|
if (volume) scene.music.play()
|
||||||
} else {
|
} else {
|
||||||
scene.music.pause()
|
scene.music.pause()
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,25 @@
|
|||||||
import * as THREE from 'three'
|
import * as THREE from 'three'
|
||||||
|
|
||||||
|
|
||||||
class Vortex extends THREE.Group {
|
export class Vortex extends THREE.Group {
|
||||||
constructor(loadingManager) {
|
constructor(loadingManager) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
const commonCylinderGeometry = new THREE.CylinderGeometry(35, 35, 500, 12, 1, true)
|
|
||||||
|
|
||||||
|
|
||||||
this.globalRotation = 0.028
|
this.globalRotation = 0.028
|
||||||
|
|
||||||
this.darkTextureRotation = 0.006
|
this.darkTextureRotation = 0.006
|
||||||
this.darkMoveForward = 0.007
|
this.darkMoveForward = 0.012
|
||||||
|
|
||||||
this.colorFullTextureRotation = 0.006
|
this.colorFullTextureRotation = 0.006
|
||||||
this.colorFullMoveForward = 0.02
|
this.colorFullMoveForward = 0.016
|
||||||
|
|
||||||
|
const commonCylinderGeometry = new THREE.CylinderGeometry(35, 35, 500, 12, 1, true)
|
||||||
|
|
||||||
this.background = "Plasma"
|
this.background = "Plasma"
|
||||||
|
|
||||||
this.darkCylinder = new THREE.Mesh(
|
this.darkCylinder = new THREE.Mesh(
|
||||||
commonCylinderGeometry,
|
commonCylinderGeometry,
|
||||||
new THREE.MeshLambertMaterial({
|
new THREE.MeshLambertMaterial({
|
||||||
side: THREE.BackSide,
|
|
||||||
map: new THREE.TextureLoader(loadingManager).load("./images/plasma.jpg", (texture) => {
|
|
||||||
texture.wrapS = THREE.RepeatWrapping
|
|
||||||
texture.wrapT = THREE.MirroredRepeatWrapping
|
|
||||||
texture.repeat.set(1, 1)
|
|
||||||
}),
|
|
||||||
blending: THREE.AdditiveBlending,
|
|
||||||
opacity: 0.1
|
|
||||||
})
|
|
||||||
)
|
|
||||||
this.darkCylinder.position.set(5, 10, -10)
|
|
||||||
this.add(this.darkCylinder)
|
|
||||||
|
|
||||||
this.colorFullCylinder = new THREE.Mesh(
|
|
||||||
commonCylinderGeometry,
|
|
||||||
new THREE.MeshBasicMaterial({
|
|
||||||
side: THREE.BackSide,
|
side: THREE.BackSide,
|
||||||
map: new THREE.TextureLoader(loadingManager).load("./images/plasma2.jpg", (texture) => {
|
map: new THREE.TextureLoader(loadingManager).load("./images/plasma2.jpg", (texture) => {
|
||||||
texture.wrapS = THREE.RepeatWrapping
|
texture.wrapS = THREE.RepeatWrapping
|
||||||
@ -44,23 +27,36 @@ class Vortex extends THREE.Group {
|
|||||||
texture.repeat.set(2, 1)
|
texture.repeat.set(2, 1)
|
||||||
}),
|
}),
|
||||||
blending: THREE.AdditiveBlending,
|
blending: THREE.AdditiveBlending,
|
||||||
opacity: 0.6
|
opacity: 0.75
|
||||||
|
})
|
||||||
|
)
|
||||||
|
this.add(this.darkCylinder)
|
||||||
|
|
||||||
|
this.colorFullCylinder = new THREE.Mesh(
|
||||||
|
commonCylinderGeometry,
|
||||||
|
new THREE.MeshBasicMaterial({
|
||||||
|
side: THREE.BackSide,
|
||||||
|
map: new THREE.TextureLoader(loadingManager).load("./images/plasma.jpg", (texture) => {
|
||||||
|
texture.wrapS = THREE.RepeatWrapping
|
||||||
|
texture.wrapT = THREE.MirroredRepeatWrapping
|
||||||
|
texture.repeat.set(1, 1)
|
||||||
|
}),
|
||||||
|
blending: THREE.AdditiveBlending,
|
||||||
|
opacity: 0.075
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
this.colorFullCylinder.position.set(5, 10, -10)
|
|
||||||
this.add(this.colorFullCylinder)
|
this.add(this.colorFullCylinder)
|
||||||
|
|
||||||
|
this.position.set(5, 10, -10)
|
||||||
}
|
}
|
||||||
|
|
||||||
update(delta) {
|
update(delta) {
|
||||||
this.darkCylinder.rotation.y += this.globalRotation * delta
|
this.rotation.y += this.globalRotation * delta
|
||||||
|
|
||||||
this.darkCylinder.material.map.offset.y += this.darkMoveForward * delta
|
this.darkCylinder.material.map.offset.y += this.darkMoveForward * delta
|
||||||
this.darkCylinder.material.map.offset.x += this.darkTextureRotation * delta
|
this.darkCylinder.material.map.offset.x += this.darkTextureRotation * delta
|
||||||
|
|
||||||
this.colorFullCylinder.rotation.y += this.globalRotation * delta
|
|
||||||
this.colorFullCylinder.material.map.offset.y += this.colorFullMoveForward * delta
|
this.colorFullCylinder.material.map.offset.y += this.colorFullMoveForward * delta
|
||||||
this.colorFullCylinder.material.map.offset.x += this.colorFullTextureRotation * delta
|
this.colorFullCylinder.material.map.offset.x += this.colorFullTextureRotation * delta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export { Vortex }
|
|
Loading…
x
Reference in New Issue
Block a user