-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
165 lines (129 loc) · 4.02 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
<!DOCTYPE html>
<html lang = "en">
<head>
<title>backdrop-filter:blur on text</title>
<meta name = "Description" content = "How to apply 'backdrop-filter:blur()' to a text element">
<meta charset = "UTF-8">
<meta name = "viewport" content = "width=device-width, initial-scale=1.0">
<link rel = "icon" type = "image/jpg" href = "./images/favicon.png">
<link rel = "stylesheet" href = "./secondaryCss/secondaryCss.css" media = "print" onload = "this.media='all'">
<script async src = "./js/demo.js"></script>
<style>
:root {
--svgPath:./svgs/standard.svg;
--svgUrl: url(./svgs/standard.svg);
--backgroundUrl:url(./images/backgroundOriginal.jpg);
--backgroundBlurredUrl:url(./images/backgroundBlurred.jpg);
}
.backgroundLayer {
z-index: -1;
width: 100vw;
height: 100vh;
display: flex;
position: fixed;
background: var(--backgroundUrl) 0 0;
background-repeat: no-repeat;
background-position: center;
}
#svgWrapper {
position: absolute;
width:100%;
height: 100%;
top:50%;
}
#svg {
width: 100%;
height: 100%;
-webkit-transform: translateZ(0);
transform: translateZ(0);
/* Chrome, Safari and all webkit browsers */
-webkit-mask-image: var(--svgUrl);
-webkit-mask-size: contain;
-webkit-mask-position: center;
-webkit-mask-repeat: no-repeat;
/* FIREFOX */
mask-image: var(--svgUrl);
mask-size: contain;
mask-position: center;
mask-repeat: no-repeat;
}
#svg.reset {
-webkit-mask-image: none;
mask-image: none;
}
#svgShadow {
width:100%;
height:100%;
-webkit-transform: translate3d(0,-100%, 0);
transform: translate3d(0,-100%, 0);
}
#svgShadow.enabled {
opacity: 1;
}
#svgShadow.disabled {
opacity: 0;
}
#svg.method1 {
filter: blur(13px) saturate(250%);
-webkit-filter: blur(13px) saturate(250%);
-moz-filter: blur(13px) saturate(250%);
-ms-filter: blur(13px) saturate(250%);
-o-filter: blur(13px) saturate(250%);
background: var(--backgroundUrl);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
#svg.method2 {
background-color: rgba(255,255,255,0.1);
-webkit-backdrop-filter: blur(13px) saturate(250%);
backdrop-filter: blur(13px) saturate(250%);
}
#svg.method3 {
background: var(--backgroundBlurredUrl);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}
</style>
</head>
<body onload = "init()">
<!-- MENU SECTION -->
<div id = "buttonSectionLeft" class = "buttonSection">
<button id = "hideButtonSectionLeft" class = "hideButtonSection"></button>
<button id = "method1">Method 1
<span class="tooltiptext">filter:blur()</span>
</button>
<button id = "method2">Method 2
<span class="tooltiptext">backdrop-filter:blur()</span>
</button>
<button id = "method3">Method 3
<span class="tooltiptext">pre-blurred background</span>
</button>
<button id = "disableShadows">Shadows Disabled
<span class="tooltiptext">Toggle SVG Shadow ON/OFF</span>
</button>
</div>
<div id = "buttonSectionRight" class = "buttonSection hidden">
<button id = "hideButtonSectionRight" class = "hideButtonSection"></button>
<button id = "changeBackground">Change Wallpaper
<input id = "changeBackgroundInputField" type = "file" name = "name" accept="image/*" style = "display:none;" />
</button>
</div>
<!-- BACKGROUND -->
<section class = "backgroundLayer"></section>
<!-- HOW TO APPLY BACKDROP-FILTER:BLUR ON TEXT -->
<section id = "svgWrapper">
<div id = "svg"></div>
<svg id = "svgShadow" class = "disabled">
<defs>
<filter id = "trans-shadow">
<feGaussianBlur stdDeviation = "5"/>
<feComposite operator = "out" in2 = "SourceGraphic"/>
</filter>
</defs>
<image id = "svgShadowImage" filter = "url(#trans-shadow)" x = "0" y = "0" width = "100%" height = "100%" />
</svg>
</section>
</body>
</html>