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