-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
executable file
·158 lines (147 loc) · 5.44 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lex-icon</title>
<link rel='shortcut icon' type='image/gif' href='images/Lex.gif'/>
<link rel="stylesheet" type="text/css" href="css/starter.css" />
<meta name="description" content="A webapp that improves vocabulary skills" />
<meta name="keywords" content="english, words, vocabulary, learn, language, social, Lex-icon" />
<meta name="author" content="Lex-icon" />
<meta name="p:domain_verify" content="747e16c2739c522c9e3095429ceff858"/>
<script>document.documentElement.className="js";var supportsCssVars=function(){var e,t=document.createElement("style");return t.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(t),e=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),t.parentNode.removeChild(t),e};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
</head>
<body class="demo-1">
<svg class="hidden">
<symbol id="icon-nav-arrow" viewBox="0 0 90 64">
<title>nav-arrow</title>
<path d="M88.148 30.124H6.404L33.208 3.32a1.877 1.877 0 0 0 0-2.652 1.877 1.877 0 0 0-2.652 0L.552 30.67a1.942 1.942 0 0 0-.409.612 1.86 1.86 0 0 0 0 1.432c.094.233.233.44.41.612L30.555 63.33c.367.368.847.552 1.328.552.48 0 .96-.184 1.327-.548a1.877 1.877 0 0 0 0-2.652L6.404 33.874h81.743a1.876 1.876 0 0 0 0-3.75z"/>
</symbol>
</svg>
<main>
<div class="content">
<div class="slideshow">
<div class="slide slide--current">
<div class="slide__bg slide__bg--6"></div>
<h2 class="word word--6">Lex-icon</h2>
</div>
</div>
</div>
</main>
<script>
setTimeout(function(){
window.location.href = 'index1.html';
}, 1900);
</script>
<script src="js/charming.min.js"></script>
<script src="js/anime.min.js"></script>
<script src="js/wordFx.js"></script>
<script>
{
const effects = [
{
options: {
shapeColors: ['#fff','#dedede','#8c8c8c','#545454','#000','#dc2e2e']
},
hide: {
lettersAnimationOpts: {
duration: 500,
delay: (t,i,total) => (total-i-1)*80,
easing: 'easeOutExpo',
opacity: {
value: [1,0],
duration: 100,
delay: (t,i,total) => (total-i-1)*50,
easing: 'linear'
},
scale: [1,0]
}
},
show: {
lettersAnimationOpts: {
duration: 800,
delay: (t,i) => i*80,
easing: 'easeInExpo',
opacity: [0,1],
scale: [0,1]
},
shapesAnimationOpts: {
duration: 1300,
delay: (t,i) => i*70,
easing: 'easeOutExpo',
translateX: () => [0,anime.random(-20,20)],
translateY: () => [0,anime.random(-400,400)],
scale: () => [randomBetween(0.2,0.6),randomBetween(0.2,0.6)],
rotate: () => [0,anime.random(-16,16)],
opacity: [
{value: 1, duration: 1, easing: 'linear'},
{value: 0, duration: 700, easing: 'easeOutQuad'}
]
}
}
}
];
class Slideshow {
constructor(el) {
this.DOM = {};
this.DOM.el = el;
this.DOM.slides = Array.from(this.DOM.el.querySelectorAll('.slide'));
this.DOM.bgs = Array.from(this.DOM.el.querySelectorAll('.slide__bg'));
this.DOM.words = Array.from(this.DOM.el.querySelectorAll('.word'));
this.slidesTotal = this.DOM.slides.length;
this.current = 0;
this.words = [];
this.DOM.words.forEach((word, pos) => {
this.words.push(new Word(word, effects[pos].options));
});
this.isAnimating = true;
this.words[this.current].show(effects[this.current].show).then(() => this.isAnimating = false);
}
show(direction) {
if ( this.isAnimating ) return;
this.isAnimating = true;
let newPos;
let currentPos = this.current;
if ( direction === 'next' ) {
newPos = currentPos < this.slidesTotal - 1 ? currentPos+1 : 0;
}
else if ( direction === 'prev' ) {
newPos = currentPos > 0 ? currentPos-1 : this.slidesTotal - 1;
}
this.DOM.slides[newPos].style.opacity = 1;
this.DOM.bgs[newPos].style.transform = 'none';
anime({
targets: this.DOM.bgs[currentPos],
duration: 600,
easing: [0.2,1,0.3,1],
translateY: ['0%', direction === 'next' ? '-100%' : '100%'],
complete: () => {
this.DOM.slides[currentPos].classList.remove('slide--current');
this.DOM.slides[currentPos].style.opacity = 0;
this.DOM.slides[newPos].classList.add('slide--current');
this.words[newPos].show(effects[newPos].show).then(() => this.isAnimating = false);
}
});
this.words[newPos].hide();
this.words[this.current].hide(effects[currentPos].hide).then(() => {
this.current = newPos;
});
}
}
const slideshow = new Slideshow(document.querySelector('.slideshow'));
document.querySelector('.slidenav__item--prev').addEventListener('click', () => slideshow.show('prev') );
document.querySelector('.slidenav__item--next').addEventListener('click', () => slideshow.show('next') );
document.addEventListener('keydown', (ev) => {
const keyCode = ev.keyCode || ev.which;
if ( keyCode === 37 ) {
slideshow.show('prev');
}
else if ( keyCode === 39 ) {
slideshow.show('next');
}
});
}
</script>
</body>
</html>