-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
38 lines (32 loc) · 1.01 KB
/
index.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
<script>
const bgColor = '#9BB7D4'
const gifURL = "figure-1.png";
const gifOffsetX = 0
const gifOffsetY = 0
function createGif (x, y) {
const gif = document.createElement('img')
gif.src = gifURL + '#' + Math.random()
document.body.appendChild(gif)
gif.width = 80
gif.style.position = 'absolute'
gif.style.left = x + 'px'
gif.style.top = y + 'px'
}
function createGifCircle (num, scale, radius) {
for (let i = 0; i < num; i++) {
const cx = window.innerWidth / 2 - gifOffsetX
const cy = window.innerHeight / 2 - gifOffsetY
const x = cx + Math.sin(i * scale) * radius
const y = cy + Math.cos(i * scale) * radius
createGif(x, y)
}
}
function setup () {
document.body.style.backgroundColor = bgColor
document.body.style.overflow = 'hidden'
createGifCircle(22, 0.3, 100)
setTimeout(createGifCircle, 100, 22, 0.3, 150)
setTimeout(createGifCircle, 200, 22, 0.3, 200)
}
window.addEventListener('load', setup)
</script>