-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathindex.html
237 lines (223 loc) · 7.99 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Grid to Fullscreen Animations | Codrops</title>
<meta name="description" content="A set of thumbnail to fullscreen animations for image grids powered by Three.js" />
<meta name="keywords" content="image grid, animation, fullscreen, webgl, three.js, web design" />
<meta name="author" content="Codrops" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" href="https://use.typekit.net/ujk6ksk.css" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>document.documentElement.className="js";var supportsCssVars=function(){var a,b=document.createElement("style");return b.innerHTML="root: { --tmp-var: bold; }",document.head.appendChild(b),a=!!(window.CSS&&window.CSS.supports&&window.CSS.supports("font-weight","var(--tmp-var)")),b.parentNode.removeChild(b),a};supportsCssVars()||alert("Please view this demo in a modern browser that supports CSS Variables.");</script>
<!--script src="//tympanus.net/codrops/adpacks/analytics.js"></script-->
</head>
<body class="loading demo-1">
<main>
<div class="frame">
<div class="frame__title-wrap">
<h1 class="frame__title">Grid to Fullscreen Animations</h1>
<div class="frame__links">
<a href="https://tympanus.net/Development/AnimatedImageColumns/">Previous demo</a>
<a href="https://tympanus.net/codrops/?p=40491">Article</a>
<a href="https://github.com/Anemolo/GridToFullscreenAnimations">GitHub</a>
</div>
</div>
<div class="frame__demos">
<span class="frame__demos-title">examples:</span>
<a href="index.html" class="frame__demo frame__demo--current">01</a>
<a href="index2.html" class="frame__demo">02</a>
<a href="index3.html" class="frame__demo">03</a>
<a href="index4.html" class="frame__demo">04</a>
<a href="index5.html" class="frame__demo">05</a>
<a href="index6.html" class="frame__demo">06</a>
</div>
</div>
<!-- /frame -->
<div class="deco">
<div class="deco__text">Connect 2019</div>
<div class="deco__text">Connect 2020</div>
<div class="deco__text">Connect 2020</div>
<div class="deco__text">Connect 2020</div>
<div class="deco__text">Connect 2020</div>
</div>
<div id="app"></div>
<div class="grid" id="itemsWrapper">
<figure class="grid__item">
<img class="grid__item-img" src="img/1.jpg" alt="An image" />
<img class="grid__item-img grid__item-img--large" src="img/1_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">Paris</h2>
<p class="grid__item-text">
If you are lucky enough to have lived in Paris as a young man,
then wherever you go for the rest of your life it stays with you,
for Paris is a moveable feast.
</p>
</figcaption>
</figure>
<figure class="grid__item">
<img class="grid__item-img" src="img/2.jpg" alt="An image" />
<img class="grid__item-img grid__item-img--large" src="img/2_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">Barcelona</h2>
<p class="grid__item-text">
We crossed spacious streets, with building resembling palaces, in
La Rambla promenade; the shops were well illuminated and there was
movement and life.
</p>
</figcaption>
</figure>
<figure class="grid__item">
<img class="grid__item-img" src="img/3.jpg" alt="An image" />
<img class="grid__item-img grid__item-img--large" src="img/3_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">Rome</h2>
<p class="grid__item-text">
And that is… how they are. So terribly physically all over one
another. They pour themselves one over the other like so much
melted butter over parsnips.
</p>
</figcaption>
</figure>
</div>
<div class="fullview">
<div class="fullview__item">
<h2 class="fullview__item-title">Paris</h2>
</div>
<div class="fullview__item">
<h2 class="fullview__item-title">Barcelona</h2>
</div>
<div class="fullview__item">
<h2 class="fullview__item-title">Rome</h2>
</div>
<button class="fullview__close" aria-label="Close preview"><svg aria-hidden="true" width="24" height="22px" viewBox="0 0 24 22"><path d="M11 9.586L20.192.393l1.415 1.415L12.414 11l9.193 9.192-1.415 1.415L11 12.414l-9.192 9.193-1.415-1.415L9.586 11 .393 1.808 1.808.393 11 9.586z" /></svg></button>
</div>
</main>
<script src="js/imagesloaded.pkgd.min.js"></script>
<script src="js/three.min.js"></script>
<script src="js/TweenLite.min.js"></script>
<script src="js/CSSPlugin.min.js"></script>
<script src="js/EasePack.min.js"></script>
<script src="js/GridToFullscreenEffect.js"></script>
<script src="js/basicDemo.js"></script>
<script>
let currentIndex;
const itemsWrapper = document.getElementById("itemsWrapper");
const thumbs = [...itemsWrapper.querySelectorAll("img.grid__item-img:not(.grid__item-img--large)")];
const fullviewItems = [...document.querySelectorAll(".fullview__item")];
const backToGridCtrl = document.querySelector(".fullview__close");
const transitionEffectDuration = 1.8;
const transitionEffect = createDemoEffect({
activation: { type: "closestCorner" },
timing: {
duration: transitionEffectDuration
},
transformation: {
type: "flipX"
},
flipBeizerControls: {
c0: {
x: 0.4,
y: -0.8
},
c1: {
x: 0.5,
y: 0.9
}
},
onToFullscreenStart: ({ index }) => {
currentIndex = index;
thumbs[currentIndex].style.opacity = 0;
/*
TweenLite.to(itemsWrapper, .5, {
ease: Quint.easeInOut,
scale: 0.5,
opacity: 0
});
*/
toggleFullview();
},
/*
onToGridStart: ({ index }) => {
TweenLite.to(itemsWrapper, 1, {
ease: Quint.easeOut,
scale: 1,
opacity: 1
});
toggleFullview();
},
*/
onToGridFinish: ({ index, lastIndex }) => {
thumbs[lastIndex].style.opacity = 1;
fullviewItems[currentIndex].classList.remove("fullview__item--current");
},
easings: {
toFullscreen: Quint.easeOut,
toGrid: Quint.easeOut
}
});
transitionEffect.init();
const toggleFullview = () => {
if ( transitionEffect.isFullscreen ) {
TweenLite.to(fullviewItems[currentIndex].querySelector(".fullview__item-title"), 0.2, {
ease: Quad.easeOut,
opacity: 0,
x: "5%"
});
TweenLite.to(backToGridCtrl, 0.2, {
ease: Quad.easeOut,
opacity: 0,
scale: 0
});
transitionEffect.toGrid();
}
else {
fullviewItems[currentIndex].classList.add("fullview__item--current");
TweenLite.to(fullviewItems[currentIndex].querySelector(".fullview__item-title"), 0.8, {
ease: Expo.easeOut,
startAt: {x: "5%"},
opacity: 1,
x: "0%",
delay: transitionEffectDuration*0.3
});
TweenLite.to(backToGridCtrl, 0.8, {
ease: Expo.easeOut,
startAt: {scale: 0},
opacity: 1,
scale: 1,
delay: transitionEffectDuration*0.3
});
}
};
backToGridCtrl.addEventListener("click", () => {
if ( transitionEffect.isAnimating ) {
return;
}
toggleFullview();
});
// Preload all the images in the pageI
imagesLoaded(document.querySelectorAll("img"), instance => {
//https://www.techrepublic.com/article/preloading-and-the-javascript-image-object/
document.body.classList.remove("loading");
// Make Images sets for creating the textures.
let images = [];
for (var i = 0, imageSet = {}; i < instance.elements.length; i++) {
let image = {
element: instance.elements[i],
image: instance.images[i].isLoaded ? instance.images[i].img : null
};
if (i % 2 === 0) {
imageSet = {};
imageSet.small = image;
}
if (i % 2 === 1) {
imageSet.large = image;
images.push(imageSet);
}
}
transitionEffect.createTextures(images);
});
</script>
</body>
</html>