Edit joints in background
All checks were successful
Build frontend / build (push) Successful in 59s

Added check DarkMode in home for switch light and dark
This commit is contained in:
Rahaf
2026-01-25 09:43:58 +03:00
parent 4ec438b9f5
commit 186df288f9
4 changed files with 98 additions and 58 deletions

View File

@ -27,9 +27,9 @@ const BackgroundCanvas = ({ theme = "light" }) => {
this.bone_length = 150;
const shapes = ["circle", "triangle", "square", "pentagon"];
this.shape = shapes[Math.floor(Math.random() * shapes.length)];
this.size = Math.random() * 4 + 3;
this.size = Math.random() * 3 + 2;
this.angle = 0;
this.angularSpeed = (Math.random() - 0.5) * 0.1;
this.angularSpeed = (Math.random() - 0.5) * 0.5;
this.pulse = Math.random() * Math.PI * 2;
}
}
@ -57,7 +57,7 @@ const BackgroundCanvas = ({ theme = "light" }) => {
joint.position.y += joint.vector.y * joint.speed;
joint.angle += joint.angularSpeed;
joint.pulse += 0.05;
joint.pulse += 0.03;
if (joint.position.x < 0) joint.position.x = world.width;
if (joint.position.x > world.width) joint.position.x = 0;
@ -76,7 +76,7 @@ const BackgroundCanvas = ({ theme = "light" }) => {
pointColor = "#e06923";
} else {
backgroundColor = "#f1f1f1ff";
lineColor = "rgba(49, 49, 49, 0.3)"; // More subtle lines
lineColor = "rgba(49, 49, 49, 0.3)";
pointColor = "#041c40";
}
@ -193,7 +193,7 @@ const BackgroundCanvas = ({ theme = "light" }) => {
);
const isMobile = window.innerWidth < 768;
const numberOfJoints = isMobile ? 150 : 600;
const numberOfJoints = isMobile ? 120 : 500;
jointsRef.current = generateJoints(
numberOfJoints,
worldRef.current.width,
@ -202,8 +202,8 @@ const BackgroundCanvas = ({ theme = "light" }) => {
if (isMobile) {
jointsRef.current.forEach((joint) => {
joint.bone_length = 120;
joint.speed = 0.4;
joint.bone_length = 80;
joint.speed = 0.3;
});
}
};