-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathindex4.html
209 lines (198 loc) · 7.55 KB
/
index4.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
<!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-4">
<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">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 frame__demo--current">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 2020</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/10.jpg" alt="A picture of Montparnasse in Paris" />
<img class="grid__item-img grid__item-img--large" src="img/10_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">Neka Lax</h2>
<p class="grid__item-text">
Everything is happy if you choose to make it that way. See. We take the corner of the brush and let it play back-and-forth.
</p>
</figcaption>
</figure>
<figure class="grid__item">
<img class="grid__item-img" src="img/11.jpg" alt="A picture of a street in Barcelona" />
<img class="grid__item-img grid__item-img--large" src="img/11_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">André Free</h2>
<p class="grid__item-text">
You can't make a mistake. Anything that happens you can learn to use - and make something beautiful out of it. God gave you this gift of imagination.
</p>
</figcaption>
</figure>
<figure class="grid__item">
<img class="grid__item-img" src="img/12.jpg" alt="A picture of a street in Rome" />
<img class="grid__item-img grid__item-img--large" src="img/12_large.jpg" />
<figcaption class="grid__item-caption">
<h2 class="grid__item-title">Wisma Green</h2>
<p class="grid__item-text">
This present moment is perfect simply due to the fact you're experiencing it. We're trying to teach you a technique here and how to use it.
</p>
</figcaption>
</figure>
</div>
<div class="fullview">
<div class="fullview__item">
<h2 class="fullview__item-title">Neka Lax</h2>
</div>
<div class="fullview__item">
<h2 class="fullview__item-title">André Free</h2>
</div>
<div class="fullview__item">
<h2 class="fullview__item-title">Wisma Green</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.2;
const transitionEffect = createDemoEffect({
activation: { type: "mouse" },
timing: {
duration: transitionEffectDuration
},
transformation: {
type: "simplex",
props: {
seed: "8000",
frequencyX: 0.2,
frequencyY: 0.2,
amplitudeX: 0.3,
amplitudeY: 0.3
}
},
onToFullscreenStart: ({ index }) => {
currentIndex = index;
thumbs[currentIndex].style.opacity = 0;
transitionEffect.uniforms.uSeed.value = index * 10;
toggleFullview();
},
onToGridFinish: ({ index, lastIndex }) => {
thumbs[lastIndex].style.opacity = 1;
fullviewItems[currentIndex].classList.remove("fullview__item--current");
},
seed: 800,
easings: {
toFullscreen: Power1.easeOut,
toGrid: Power1.easeInOut
}
});
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"), 1, {
ease: Expo.easeOut,
startAt: { x: "5%" },
opacity: 1,
x: "0%",
delay: transitionEffectDuration * 0.6
});
TweenLite.to(backToGridCtrl, 1, {
ease: Expo.easeOut,
startAt: { scale: 0 },
opacity: 1,
scale: 1,
delay: transitionEffectDuration * 0.6
});
}
};
backToGridCtrl.addEventListener("click", () => {
if (transitionEffect.isAnimating) {
return;
}
toggleFullview();
});
// Preload all the images in the page
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 the transition effect
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>