-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
48 lines (39 loc) · 1.39 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
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body>
<div class="container">
<div class="content">
<h1>{Title}</h1>
</div>
<div class="img"></div>
</div>
<div class="container2">
<div class="content">
<h1>{Title}</h1>
</div>
<div class="img"></div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.6.1/gsap.min.js"
integrity="sha512-cdV6j5t5o24hkSciVrb8Ki6FveC2SgwGfLE31+ZQRHAeSRxYhAQskLkq3dLm8ZcWe1N3vBOEYmmbhzf7NTtFFQ=="
crossorigin="anonymous">
</script>
<script>
const tl = gsap.timeline({ paused: true, defaults: { duration: .05 } })
const container = document.querySelector('.container')
tl.to(container, { clipPath: 'polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)' })
tl.to(container, { clipPath: 'polygon(100% 0%, 100% 0%, 100% 100%, 100% 100%)' }, '+=1')
tl.to('h1', { color: 'white' })
tl.to('.container2', { clipPath: 'polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)' })
container.addEventListener('mouseover', () => {
tl.play()
})
</script>
</body>
</html>