-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathripples.html
49 lines (44 loc) · 1.46 KB
/
ripples.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ripples</title>
<link rel="stylesheet" href="css/ripples.css">
<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/anime.min.js"></script>
</head>
<body>
<svg width="1920" height="1080">
<circle class="el" style="fill: none; stroke: #FFF; stroke-width: 0px; opacity: 0.0" cx="100" cy="100" r="2"></circle>
<circle class="el" style="fill: none; stroke: #FFF; stroke-width: 0px; opacity: 0.0" cx="100" cy="100" r="2"></circle>
<circle class="el" style="fill: none; stroke: #FFF; stroke-width: 0px; opacity: 0.0" cx="100" cy="100" r="2"></circle>
</svg>
<script>
var maxX = 960;
var maxY = 1080;
var moveWave = function() {
var newX = Math.floor(Math.random() * maxX) + 1;
var newY = Math.floor(Math.random() * maxY) + 1;
$('.el').attr('cx', newX);
$('.el').attr('cy', newY);
};
var waveAnimation = function() {
anime({
targets: '.el',
r: 200,
opacity: [
{value: 0.8, duration: 250},
{value: 0.0, duration: 1250}
],
"stroke-width": [2, 18, 0],
duration: 1500,
delay: anime.stagger(400),
easing: 'easeInOutSine',
loop: true,
loopComplete: moveWave,
});
};
waveAnimation();
</script>
</body>
</html>