-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
177 lines (158 loc) · 6.93 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Emoji effect</title>
</head>
<body>
<style>
html,
body,
#root {
width: 100%;
height: 100%;
}
body {
margin: 0;
overflow: hidden;
}
.container {
position: relative;
display: inline-block;
user-select: none;
filter: drop-shadow(rgba(0, 0, 0, 0.45) 0px 0px 2px);
max-width: 100%;
}
.container svg,
.container img {
max-width: 100%;
}
</style>
<div id="emoji-container" class="container">
<svg width="0" height="0">
<filter id="emojiFilter" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" result="blur1" stdDeviation="3"></feGaussianBlur>
<feSpecularLighting result="spec1" in="blur1" surfaceScale="5" specularConstant="0.5" lighting-color="#ffffff"
specularExponent="120">
<fePointLight id="light" data-name="light" x="125" y="419" z="300"></fePointLight>
</feSpecularLighting>
<feComposite in="spec1" in2="SourceAlpha" operator="in" result="specOut2"></feComposite>
<feComposite in="SourceGraphic" in2="specOut2" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"
result="litPaint"></feComposite>
</filter>
</svg>
<div id="emoji" style="filter: url("#emojiFilter"); isolation: isolate;">
<div style="font-size: 72px;">👻</div>
</div>
</div>
<div id="image-container" class="container">
<svg width="0" height="0">
<filter id="imageFilter" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" result="blur1" stdDeviation="3"></feGaussianBlur>
<feSpecularLighting result="spec1" in="blur1" surfaceScale="5" specularConstant="0.5" lighting-color="#ffffff"
specularExponent="120">
<fePointLight id="light" data-name="light" x="125" y="419" z="300"></fePointLight>
</feSpecularLighting>
<feComposite in="spec1" in2="SourceAlpha" operator="in" result="specOut2"></feComposite>
<feComposite in="SourceGraphic" in2="specOut2" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"
result="litPaint"></feComposite>
</filter>
</svg>
<div id="image" style="filter: url("#imageFilter"); isolation: isolate;">
<img width="100" src="./lm-logo.png" alt="">
</div>
</div>
<div id="platformeco-container" class="container">
<svg width="0" height="0">
<filter id="platformecoFilter" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" result="blur1" stdDeviation="3"></feGaussianBlur>
<feSpecularLighting result="spec1" in="blur1" surfaceScale="5" specularConstant="0.5" lighting-color="#ffffff"
specularExponent="120">
<fePointLight id="light" data-name="light" x="125" y="419" z="300"></fePointLight>
</feSpecularLighting>
<feComposite in="spec1" in2="SourceAlpha" operator="in" result="specOut2"></feComposite>
<feComposite in="SourceGraphic" in2="specOut2" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"
result="litPaint"></feComposite>
</filter>
</svg>
<div id="image" style="filter: url("#platformecoFilter"); isolation: isolate;">
<img width="100" height="70" src="./platformeco-logo.svg" alt="">
</div>
</div>
<div id="platformeco-planets-container" class="container">
<svg width="0" height="0">
<filter id="platformecoPlanets" color-interpolation-filters="sRGB" x="0" y="0" width="100%" height="100%">
<feGaussianBlur in="SourceAlpha" result="blur1" stdDeviation="3"></feGaussianBlur>
<feSpecularLighting result="spec1" in="blur1" surfaceScale="5" specularConstant="0.5" lighting-color="#ffffff"
specularExponent="120">
<fePointLight id="light" data-name="light" x="125" y="419" z="300"></fePointLight>
</feSpecularLighting>
<feComposite in="spec1" in2="SourceAlpha" operator="in" result="specOut2"></feComposite>
<feComposite in="SourceGraphic" in2="specOut2" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"
result="litPaint"></feComposite>
</filter>
</svg>
<div id="image" style="filter: url("#platformecoPlanets"); isolation: isolate;">
<img height="70" src="./platformeco-planets.webp" alt="">
</div>
</div>
<br>
<div id="platformeco-title-container" class="container">
<svg width="0" height="0">
<filter id="platformecoTitleFilter" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceAlpha" result="blur1" stdDeviation="3"></feGaussianBlur>
<feSpecularLighting result="spec1" in="blur1" surfaceScale="5" specularConstant="0.5" lighting-color="#ffffff"
specularExponent="120">
<fePointLight id="light" data-name="light" x="125" y="419" z="300"></fePointLight>
</feSpecularLighting>
<feComposite in="spec1" in2="SourceAlpha" operator="in" result="specOut2"></feComposite>
<feComposite in="SourceGraphic" in2="specOut2" operator="arithmetic" k1="0" k2="1" k3="1" k4="0"
result="litPaint"></feComposite>
</filter>
</svg>
<div id="image" style="filter: url("#platformecoTitleFilter"); isolation: isolate;">
<img height="20" src="./platformeco-title.svg" alt="">
</div>
</div>
<script>
function bindAnimation(container) {
const element = container.children[1];
const light = container.querySelector('[data-name="light"]');
const isTouchable = (('ontouchstart' in window) ||
(navigator.maxTouchPoints > 0) ||
(navigator.msMaxTouchPoints > 0))
const eventType = isTouchable ? 'pointermove' : 'mousemove';
function handleIntersect(entries) {
entries.forEach((entry) => {
if (entry.isIntersecting) {
document.addEventListener(eventType, handler);
} else {
document.removeEventListener(eventType, handler);
}
});
}
const observer = new IntersectionObserver(handleIntersect);
observer.observe(element);
function handler(event) {
const { top, left } = element.getBoundingClientRect();
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
light.setAttribute('x', event.pageX ^ 0);
light.setAttribute('y', event.pageY ^ 0);
} else {
const x = Math.round(event.clientX - left);
const y = Math.round(event.clientY - top);
light.setAttribute('x', x);
light.setAttribute('y', y);
}
}
}
bindAnimation(window['emoji-container']);
bindAnimation(window['image-container']);
bindAnimation(window['platformeco-container']);
bindAnimation(window['platformeco-title-container']);
bindAnimation(window['platformeco-planets-container']);
</script>
</body>
</html>