-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex-egg.html
81 lines (76 loc) · 3.55 KB
/
index-egg.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
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TilakT | INDIE-ORIGINALS | 3D egg</title>
<meta name="description" content="An Brief Profile of TilakT." />
<meta name="keywords" content="webgl, 3d, objects, Concept, Blocking, shatter, fragment, animation, 3D Modelling, Texturing, Texture, Painting, Rendering, 3D Artist, Engineer, Civil, Architect, Designer, Design Engineer, Thanjavur, TamilNadu, India, Visualaiser, javascript" />
<meta name="author" content="Codrops,TilakT" />
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://use.typekit.net/tsb3xby.css">
<link rel="stylesheet" type="text/css" href="css/base.css" />
<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-egg loading">
<main><div id="container"></div>
<div class="frame">
<div class="frame__deco">Move your mouse around.</div>
<div class="frame__title-wrap">
<h1 class="frame__title">Exploding 3D Objects</h1>
<div class="frame__links">
<a href="https://mintable.app/u/tilakart/wallet/">STORE</a>
<a href="https://instagram.com/minimalist.god/">IG 2</a>
<a href="https://behance.net/Tilak/">Behance</a>
</div>
</div>
<p class="frame__credits">Inspired by <a href="https://dribbble.com/shots/6019111-Kubrick-Life-Website-3D-Motion">Kubrick Life Website: 3D Motion</a></p>
<div class="frame__demos">
<a href="index.html" class="frame__demo frame__demo--current">Intro</a>
<a href="https://Tilak3D.github.io/" target="_blank" class="frame__demo">Gallery</a>
<a href="mailto:[email protected]" class="frame__demo">Mail</a>
<a href="tel:+91-9791387719" class="frame__demo">Call</a><br/>
<a href="index-icosahedron.html" class="frame__demo">Icosahedron</a>
<a href="index-heart.html" class="frame__demo">Heart</a>
<a href="index-egg.html" class="frame__demo">Egg</a>
<a href="index-brain.html" class="frame__demo">Brain</a>
</div>
</div><!-- /frame -->
</main>
<script src="js/egg.js"></script>
<script>
let animation = new explosion.default(
'container', // id of DOM el
{
surface: 'f5ebc8',
inside: 'f3ae07',
background: '151616',
onLoad: () => {
document.body.classList.remove('loading');
}
}
);
let targetMouseX = 0, mouseX = 0, ta = 0;
const sign = function(n) { return n === 0 ? 1 : n/Math.abs(n); };
document.addEventListener('mousemove',(e) => {
targetMouseX = 2*(e.clientX - animation.width/2)/animation.width;
});
document.addEventListener('touchmove',(e) => {
targetMouseX = ( e.touches[0].clientX / animation.width ) * 2 - 1;
});
animation.camera.position.y = 2;
animation.camera.position.z = 3;
function draw(){
if(animation){
mouseX += (targetMouseX - mouseX)*0.05;
ta = Math.abs(mouseX);
animation.settings.progress = ta/2;
animation.scene.rotation.y = Math.PI/2 - ta*(2 - ta)*Math.PI * sign(mouseX);
animation.camera.position.z = 3 + 3*ta;
}
window.requestAnimationFrame(draw);
}
draw()
</script>
</body>
</html>