-
Notifications
You must be signed in to change notification settings - Fork 0
/
carrd-snowbackground.html
73 lines (66 loc) · 2.09 KB
/
carrd-snowbackground.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!-- Not used -->
<head>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/tsparticles.min.js"></script>
</head>
<style>
</style>
<!-- tsParticles container -->
<div id="tsparticles"></div>
<!-- tsParticles lib - https://github.com/matteobruni/tsparticles -->
<script>
// Get the current date
var currentDate = new Date();
// Define the range of days when the script should be active (December 1st to March 1st)
var startDate = new Date(currentDate.getFullYear(), 11, 1); // 11 is December (months are 0-based)
var endDate = new Date(currentDate.getFullYear(), 2, 1); // 2 is March
// Check if the current date is within the specified range
if (currentDate >= startDate || currentDate < endDate) {
tsParticles.load("tsparticles", {
background: {
color: "transparent"
},
particles: {
color: {
value: "#EEE"
},
move: {
direction: "bottom",
enable: true,
outModes: "out",
speed: 1
},
number: {
density: {
enable: true,
area: 1000
},
value: 100
},
opacity: {
value: 0.1
},
shape: {
type: "circle"
},
size: {
value: 8
},
wobble: {
enable: true,
distance: 10,
speed: 10
},
zIndex: {
value: {
min: 0,
max: 100
}
}
}
});
var snowCanvasElement = document.querySelector('.tsparticles-canvas-el');
if (snowCanvasElement) {
snowCanvasElement.setAttribute("aria-label", "Festive snowflake animation");
}
}
</script>