code corrections smoke
parent
35085055bc
commit
764a3d2f30
|
@ -27,7 +27,7 @@ export const DriftParticlesRight = ({turboColor,scale, ...props}) => {
|
||||||
<Particles2 turboColor={turboColor} scale={scale} />
|
<Particles2 turboColor={turboColor} scale={scale} />
|
||||||
<Particles2 turboColor={turboColor} scale={scale} />
|
<Particles2 turboColor={turboColor} scale={scale} />
|
||||||
<Particles2 turboColor={turboColor} scale={scale} />
|
<Particles2 turboColor={turboColor} scale={scale} />
|
||||||
<Particles2 turboColor={turboColor} scale={scale} />z
|
<Particles2 turboColor={turboColor} scale={scale} />
|
||||||
</group>
|
</group>
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -29,34 +29,19 @@ export const SmokeParticle = ({ position, png, leftDrift, rightDrift, delay = 0
|
||||||
|
|
||||||
const pointsCurrent = pointsRef.current;
|
const pointsCurrent = pointsRef.current;
|
||||||
|
|
||||||
if (leftDrift) {
|
if(leftDrift || rightDrift){
|
||||||
|
pointsCurrent.position.z += 0.1 * delta * 144;
|
||||||
|
|
||||||
//Set inclination
|
//Set inclination
|
||||||
|
if(leftDrift){
|
||||||
pointsCurrent.position.x -= 0.09 * delta * 144;
|
pointsCurrent.position.x -= 0.09 * delta * 144;
|
||||||
pointsCurrent.position.z += 0.1 * delta * 144;
|
|
||||||
|
|
||||||
if(pointsCurrent.position.x < -1.8) {
|
|
||||||
pointsCurrent.position.y = 0;
|
|
||||||
pointsCurrent.position.z = 0;
|
|
||||||
pointsCurrent.position.x = 0;
|
|
||||||
pointsCurrent.material.opacity = 1.5;
|
|
||||||
pointsCurrent.material.size = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pointsCurrent.material.opacity > 0) {
|
if(rightDrift){
|
||||||
pointsCurrent.material.opacity -= 0.01 * delta * 144;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pointsCurrent.material.size > 0) {
|
|
||||||
//Shrinking effect
|
|
||||||
pointsCurrent.material.size -= 0.1* delta * 144;
|
|
||||||
}
|
|
||||||
} else if (rightDrift) {
|
|
||||||
//Set inclination
|
|
||||||
pointsCurrent.position.x += 0.09 * delta * 144;
|
pointsCurrent.position.x += 0.09 * delta * 144;
|
||||||
pointsCurrent.position.z += 0.1 * delta * 144;
|
}
|
||||||
|
|
||||||
if(pointsCurrent.position.x > 1.8) {
|
if(pointsCurrent.position.x < -1.8 || pointsCurrent.position.x > 1.8) {
|
||||||
pointsCurrent.position.y = 0;
|
|
||||||
pointsCurrent.position.z = 0;
|
pointsCurrent.position.z = 0;
|
||||||
pointsCurrent.position.x = 0;
|
pointsCurrent.position.x = 0;
|
||||||
pointsCurrent.material.opacity = 1.5;
|
pointsCurrent.material.opacity = 1.5;
|
||||||
|
@ -71,13 +56,14 @@ export const SmokeParticle = ({ position, png, leftDrift, rightDrift, delay = 0
|
||||||
//Shrinking effect
|
//Shrinking effect
|
||||||
pointsCurrent.material.size -= 0.1* delta * 144;
|
pointsCurrent.material.size -= 0.1* delta * 144;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
pointsCurrent.position.y = 0;
|
|
||||||
pointsCurrent.position.z = 0;
|
pointsCurrent.position.z = 0;
|
||||||
pointsCurrent.position.x = 0;
|
pointsCurrent.position.x = 0;
|
||||||
pointsCurrent.material.opacity = 0;
|
pointsCurrent.material.opacity = 0;
|
||||||
pointsCurrent.material.size = 0;
|
pointsCurrent.material.size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -4,8 +4,6 @@ export const SmokeParticles = ({ driftRight, driftLeft }) => {
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<group>
|
|
||||||
{/* bottom left */}
|
|
||||||
<group>
|
<group>
|
||||||
<SmokeParticle
|
<SmokeParticle
|
||||||
position={[-0.6, 0.05, 0.5]}
|
position={[-0.6, 0.05, 0.5]}
|
||||||
|
@ -22,6 +20,5 @@ export const SmokeParticles = ({ driftRight, driftLeft }) => {
|
||||||
delay={200}
|
delay={200}
|
||||||
/>
|
/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue