forked from clementroche/motion-hover-effects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index3.html
91 lines (87 loc) · 4.43 KB
/
index3.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Motion Hover Effects | Demo 3</title>
<meta content="How to Create Motion Hover Effects with Image Distortions using Three.js" name="description" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="keywords" content="tutorial, three.js, hover effect, image distortion, webgl" />
<meta name="author" content="Niccolò Miranda and Clément Roche for Codrops" />
<link rel="shortcut icon" href="favicon.ico">
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/common.css" rel="stylesheet" type="text/css" />
<link href="css/style3.css" rel="stylesheet" type="text/css" />
</head>
<body class="body loading">
<main class="app">
<div class="frame">
<div class="frame__demos">
<a href="index.html" class="frame__demo">Demo 1</a>
<a href="index2.html" class="frame__demo">Demo 2</a>
<a href="index3.html" class="frame__demo frame__demo--current">Demo 3</a>
</div>
<div class="frame__wrap">
<div class="frame__credits">
<div class="credit-wrap">
<div class="frame__role">art direction / dev / photography</div>
<a aria-label="credit-1" rel="noopener" target="_blank" draggable="false" href="https://twitter.com/niccolomiranda" class="frame__link">Niccolò miranda</a>
</div>
<div class="credit-wrap">
<div class="frame__role">Development</div>
<a aria-label="credit-2" rel="noopener" target="_blank" draggable="false" href="https://twitter.com/clementroche_" class="frame__link">Clément roche</a>
</div>
</div>
<div class="frame__title-wrap">
<div class="frame__init"><em class="italic">presents</em></div>
<div class="frame__title">
<span class="span_1">How to Create Motion Hover Effects</span><br /><span class="span_2">with Image Distortions using Three.js</span>
</div>
</div>
<div class="frame__links">
<div class="frame__inner">
<a aria-label="frame-link" rel="noopener" target="_blank" draggable="false" href="https://tympanus.net/Tutorials/Interactive3DCharacter/" class="frame__link fl_1">Previous demo</a>
<a aria-label="frame-article" rel="noopener" target="_blank" draggable="false" href="https://tympanus.net/codrops/?p=44003" class="frame__link fl_1">Article</a>
</div>
</div>
</div>
</div>
<div class="grid g3">
<a aria-label="link-3" target="_blank" rel="noopener" draggable="false" class="link w-inline-block">
<h1 class="h1">los angeles</h1>
<div class="text">ranger pickup</div>
<img class="content__img" src="img/demo3/img1.jpg" alt="img1"/>
</a>
<div class="div-block">
<img src="img/slash.svg" alt="slash" class="image" />
</div>
<a aria-label="link-3" target="_blank" rel="noopener" draggable="false" class="link w-inline-block">
<h1 class="h1">california</h1>
<div class="text">city lights</div>
<img class="content__img" src="img/demo3/img2.jpg" alt="img2"/>
</a>
</div>
</main>
<script src="js/three.min.js"></script>
<script src="js/TweenLite.min.js"></script>
<script src="js/Math.js"></script>
<script src="js/EffectShell.js"></script>
<script src="js/StretchEffect.js"></script>
<script src="js/imagesloaded.pkgd.min.js"></script>
<script>
const container = document.body
const itemsWrapper = document.querySelector('.grid')
// Preload images
const preloadImages = () => {
return new Promise((resolve, reject) => {
imagesLoaded(document.querySelectorAll('img'), resolve);
});
};
// And then..
preloadImages().then(() => {
// Remove the loader
document.body.classList.remove('loading');
const effect = new StretchEffect(container, itemsWrapper)
});
</script>
</body>
</html>