Skip to content

Commit

Permalink
Let is snow slow.
Browse files Browse the repository at this point in the history
  • Loading branch information
NapoII committed Dec 24, 2023
1 parent fc6e909 commit 476df5c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/fourseasons.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ document.addEventListener("DOMContentLoaded", function () {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

const maxSnowflakes = 800; // Maximale Anzahl von Schneeflocken
const snowflakes = [];

function Snowflake() {
this.x = Math.random() * canvas.width;
this.y = Math.random() * canvas.height;
this.radius = Math.random() * 5 + 1;
this.speed = Math.random() * 3 + 1;
this.opacity = Math.random() * 0.5 + 0.1;
this.speed = Math.random() +0.2;
this.opacity = 0; // Starttransparenz auf 0 setzen
this.targetOpacity = Math.random() * 0.5 + 0.1; // Individuelle Zieltransparenz

this.draw = function () {
ctx.beginPath();
Expand All @@ -44,14 +46,21 @@ document.addEventListener("DOMContentLoaded", function () {
if (this.y > canvas.height) {
this.y = 0;
this.x = Math.random() * canvas.width;
this.targetOpacity = Math.random() * 0.5 + 0.1; // Neue Zieltransparenz setzen
}

// Erhöhe die Transparenz allmählich
this.opacity += 0.01;

// Begrenze die maximale Transparenz
this.opacity = Math.min(this.opacity, this.targetOpacity);

this.draw();
};
}

function createSnowflakes(count) {
for (let i = 0; i < count; i++) {
for (let i = 0; i < count && snowflakes.length < maxSnowflakes; i++) {
snowflakes.push(new Snowflake());
}
}
Expand Down
22 changes: 22 additions & 0 deletions promo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta property="og:title" content="Rust-Collection">
<meta property="og:description"
content="Each card in this Collection represents a valuable resource for Rust players. Just like in a trading card game, you can use these cards to enhance your Rust gameplay. Whether you're a seasoned Rust veteran or a newcomer to the game, you'll find something here to elevate your skills and knowledge.">
<meta property="og:image" content="https://raw.githubusercontent.com/NapoII/Rust-Collection/main/img/thumbn.webp">
<meta property="og:url" content="https://napoii.github.io/Rust-Collection/">
<link rel="icon" href="img/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon">

<title>Rust-Collection</title>
<link rel="stylesheet" href="styles.css">

</head>
<body>
<img src="https://raw.githubusercontent.com/NapoII/Rust-Collection/main/img/thumbn.webp" alt="Beschreibung des Bildes">
</body>
<script src="js/fourseasons.js"></script>
</html>

0 comments on commit 476df5c

Please sign in to comment.