-
Notifications
You must be signed in to change notification settings - Fork 65
/
14-finding-your-element.html
108 lines (97 loc) · 2.1 KB
/
14-finding-your-element.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<html>
<head>
<title>14 Finding Your Element</title>
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,700,900' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/2.0.2/anime.min.js"></script>
<script>var ml = { timelines: {}};</script>
<style>
body {
font: 13px "Source Sans Pro", Arial, Helvetica, sans-serif;
background-color: #45383c;
color: #fff;
text-align: center;
}
.moving-letters {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
margin: auto;
height: 200px;
}
</style>
</head>
<body>
<div class="moving-letters">
<h1 class="ml14">
<span class="text-wrapper">
<span class="letters">Find Your Element</span>
<span class="line"></span>
</span>
</h1>
<!--more-->
<script>
// Wrap every letter in a span
$('.ml14 .letters').each(function(){
$(this).html($(this).text().replace(/([^\x00-\x80]|\w)/g, "<span class='letter'>$&</span>"));
});
ml.timelines["ml14"] = anime.timeline({loop: true})
.add({
targets: '.ml14 .line',
scaleX: [0,1],
opacity: [0.5,1],
easing: "easeInOutExpo",
duration: 900
}).add({
targets: '.ml14 .letter',
opacity: [0,1],
translateX: [40,0],
translateZ: 0,
scaleX: [0.3, 1],
easing: "easeOutExpo",
duration: 800,
offset: '-=600',
delay: function(el, i) {
return 150 + 25 * i;
}
}).add({
targets: '.ml14',
opacity: 0,
duration: 1000,
easing: "easeOutExpo",
delay: 1000
});
</script>
<style>
.ml14 {
font-weight: 200;
font-size: 3.2em;
}
.ml14 .text-wrapper {
position: relative;
display: inline-block;
padding-top: 0.1em;
padding-right: 0.05em;
padding-bottom: 0.15em;
}
.ml14 .line {
opacity: 0;
position: absolute;
left: 0;
height: 2px;
width: 100%;
background-color: #fff;
transform-origin: 100% 100%;
bottom: 0;
}
.ml14 .letter {
display: inline-block;
line-height: 1em;
}
</style>
</div>
</body>
</html>