From 764a3d2f30e6cb0e25493e512eef93053bf9bf08 Mon Sep 17 00:00:00 2001
From: Riccardo Venturini <80196285+ctrlVnt@users.noreply.github.com>
Date: Mon, 19 Feb 2024 21:20:11 +0000
Subject: [PATCH] code corrections smoke
---
.../Particles/drifts/DriftParticlesRight.jsx | 2 +-
.../Particles/smoke/SmokeParticle.jsx | 40 ++++++-------------
.../Particles/smoke/SmokeParticles.jsx | 31 +++++++-------
3 files changed, 28 insertions(+), 45 deletions(-)
diff --git a/src/components/Particles/drifts/DriftParticlesRight.jsx b/src/components/Particles/drifts/DriftParticlesRight.jsx
index 4bad1a8..99b481a 100644
--- a/src/components/Particles/drifts/DriftParticlesRight.jsx
+++ b/src/components/Particles/drifts/DriftParticlesRight.jsx
@@ -27,7 +27,7 @@ export const DriftParticlesRight = ({turboColor,scale, ...props}) => {
- z
+
)
}
\ No newline at end of file
diff --git a/src/components/Particles/smoke/SmokeParticle.jsx b/src/components/Particles/smoke/SmokeParticle.jsx
index ee7b9d5..9bf1558 100644
--- a/src/components/Particles/smoke/SmokeParticle.jsx
+++ b/src/components/Particles/smoke/SmokeParticle.jsx
@@ -29,13 +29,19 @@ export const SmokeParticle = ({ position, png, leftDrift, rightDrift, delay = 0
const pointsCurrent = pointsRef.current;
- if (leftDrift) {
- //Set inclination
- pointsCurrent.position.x -= 0.09 * delta * 144;
+ if(leftDrift || rightDrift){
pointsCurrent.position.z += 0.1 * delta * 144;
-
- if(pointsCurrent.position.x < -1.8) {
- pointsCurrent.position.y = 0;
+
+ //Set inclination
+ if(leftDrift){
+ pointsCurrent.position.x -= 0.09 * delta * 144;
+ }
+
+ if(rightDrift){
+ pointsCurrent.position.x += 0.09 * delta * 144;
+ }
+
+ if(pointsCurrent.position.x < -1.8 || pointsCurrent.position.x > 1.8) {
pointsCurrent.position.z = 0;
pointsCurrent.position.x = 0;
pointsCurrent.material.opacity = 1.5;
@@ -50,34 +56,14 @@ export const SmokeParticle = ({ position, png, leftDrift, rightDrift, delay = 0
//Shrinking effect
pointsCurrent.material.size -= 0.1* delta * 144;
}
- } else if (rightDrift) {
- //Set inclination
- 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 {
- pointsCurrent.position.y = 0;
pointsCurrent.position.z = 0;
pointsCurrent.position.x = 0;
pointsCurrent.material.opacity = 0;
pointsCurrent.material.size = 0;
}
+
});
return (
diff --git a/src/components/Particles/smoke/SmokeParticles.jsx b/src/components/Particles/smoke/SmokeParticles.jsx
index 3aa5157..0050690 100644
--- a/src/components/Particles/smoke/SmokeParticles.jsx
+++ b/src/components/Particles/smoke/SmokeParticles.jsx
@@ -5,23 +5,20 @@ export const SmokeParticles = ({ driftRight, driftLeft }) => {
return (
- {/* bottom left */}
-
-
-
-
+
+
);
};