graflow 1.0

This commit is contained in:
STEINNI
2025-12-22 16:38:45 +00:00
parent 0b708c2dbd
commit 906dd7b317
8 changed files with 327 additions and 245 deletions
+18 -7
View File
@@ -228,7 +228,7 @@ class Intro{
this.matEE.defines = this.matEE.defines || {}
this.matEE.defines.USE_UV = ""
this.matEE.onBeforeCompile = shader => {
shader.uniforms.uReveal = { value: 0 }
shader.uniforms.uReveal = { value: -0.3 }
shader.uniforms.uTime = { value: 0 };
shader.fragmentShader = shader.fragmentShader
.replace(
@@ -241,15 +241,26 @@ class Intro{
.replace(
`#include <envmap_fragment>`,
`#include <envmap_fragment>
if ((uReveal-vUv.x) < (1.0-uReveal)){
float random = fract(sin(dot(gl_FragCoord.xy + vec2(uTime) , vec2(12.9898,78.233))) * 43758.5453);
if(random > 0.1) discard;
}
float bandWidth = 0.20;
if (vUv.x > uReveal) {
float d = (vUv.x - uReveal) / bandWidth; // 0 at front, grows to the right
if (d < 1.0) { // inside noisy band
float density = smoothstep(1.0, 0.0, d);
float random = fract( sin(dot(gl_FragCoord.xy + vec2(uTime), vec2(12.9898,78.233))) * 43758.5453 );
if (random > density) discard;
} else {
// fully hidden
discard;
}
}
`
)
this.matEE.userData.shader = shader
}
this.planeEE = new THREE.Mesh(geo, this.matEE)
this.planeEE.scale.set(.2, .2, 1)
this.planeEE.position.set(0,-0.8,.1)
@@ -269,7 +280,7 @@ class Intro{
requestAnimationFrame(this.animate.bind(this))
if (this.matEE.userData.shader) {
if(this.matEE.userData.shader.uniforms.uReveal.value<1){
this.matEE.userData.shader.uniforms.uReveal.value += 0.01
this.matEE.userData.shader.uniforms.uReveal.value += 0.005
this.matEE.userData.shader.uniforms.uTime.value = Math.floor(performance.now() / 200)
}
}