-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheksperymentv2.html
More file actions
executable file
·68 lines (60 loc) · 1.92 KB
/
eksperymentv2.html
File metadata and controls
executable file
·68 lines (60 loc) · 1.92 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Heart Balloons</title>
<style>
/*body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden; /* Prevent scrolling */
/*}*/
.heart {
position: relative;
background-color: transparent;
font-size: 50px;
color: #ff8080;
position: absolute;
opacity: 20%;
}
</style>
</head>
<body>
<div class="container">
<div id="heartContainer">
</div>
</div>
<script>
function createHeart() {
const heart = document.createElement('div');
heart.classList.add('heart');
var distance = Math.random() * (window.innerWidth - 20) + 10 + "px";
heart.style.left = distance; // Random position horizontally
heart.style.top = `${window.innerHeight}px`; // Start from bottom
heart.innerHTML = "♥";
var size = Math.random() * 60 + 20 + "px";
heart.style.fontSize = size;
document.getElementById('heartContainer').appendChild(heart);
//console.log(GeolocationCoordinates);
animateHeart(heart);
}
function animateHeart(heart) {
let pos = window.innerHeight; // Start from bottom
const animationInterval = setInterval(frame, 10);
function frame() {
if (pos <= -30) {
clearInterval(animationInterval);
heart.remove();
} else {
pos -= 1; // Move heart upwards
heart.style.top = pos + 'px';
}
}
}
// Create hearts periodically
setInterval(createHeart, 100);
</script>
</body>
</html>