Skip to content

Commit 96ec05c

Browse files
committed
no webgpu message
1 parent ad920ea commit 96ec05c

3 files changed

Lines changed: 63 additions & 28 deletions

File tree

index.html

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
<head>
88
<title>Gravity Pull Audio Visualizer by absulit</title>
9-
<meta name="Description"
10-
content="Audio Visualizer made with WebGPU and JavaScript">
9+
<meta name="Description" content="Audio Visualizer made with WebGPU and JavaScript">
1110

1211
<meta property="og:title" content="Gravity Pull Audio Visualizer by absulit" />
1312
<meta property="og:type" content="website" />
@@ -23,31 +22,31 @@
2322
<meta name="twitter:image" content="https://absulit.github.io/Gravity-Pull/docs/example1.webp" />
2423

2524
<script type="importmap">
26-
{
27-
"imports": {
28-
"points": "./src/points/absulit.points.module.js",
25+
{
26+
"imports": {
27+
"points": "./src/points/absulit.points.module.js",
2928

30-
"datasize": "./src/points/data-size.js",
31-
"renderpass": "./src/points/RenderPass.js",
32-
"shadertype": "./src/points/ShaderType.js",
29+
"datasize": "./src/points/data-size.js",
30+
"renderpass": "./src/points/RenderPass.js",
31+
"shadertype": "./src/points/ShaderType.js",
3332

34-
"animation": "./src/points/core/animation.js",
35-
"audio": "./src/points/core/audio.js",
36-
"color": "./src/points/core/color.js",
37-
"debug": "./src/points/core/debug.js",
38-
"effects": "./src/points/core/effects.js",
39-
"image": "./src/points/core/image.js",
40-
"math": "./src/points/core/math.js",
41-
"noise2d": "./src/points/core/noise2d.js",
42-
"classicnoise2d": "./src/points/core/classicnoise2d.js",
43-
"random": "./src/points/core/random.js",
44-
"renderpasses": "./src/points/RenderPasses.js",
45-
"sdf": "./src/points/core/sdf.js",
33+
"animation": "./src/points/core/animation.js",
34+
"audio": "./src/points/core/audio.js",
35+
"color": "./src/points/core/color.js",
36+
"debug": "./src/points/core/debug.js",
37+
"effects": "./src/points/core/effects.js",
38+
"image": "./src/points/core/image.js",
39+
"math": "./src/points/core/math.js",
40+
"noise2d": "./src/points/core/noise2d.js",
41+
"classicnoise2d": "./src/points/core/classicnoise2d.js",
42+
"random": "./src/points/core/random.js",
43+
"renderpasses": "./src/points/RenderPasses.js",
44+
"sdf": "./src/points/core/sdf.js",
4645

47-
"datgui": "./src/points/vendor/datgui/dat.gui.module.js"
48-
}
49-
}
50-
</script>
46+
"datgui": "./src/points/vendor/datgui/dat.gui.module.js"
47+
}
48+
}
49+
</script>
5150

5251
<link rel="stylesheet" type="text/css" href="style.css">
5352

@@ -58,11 +57,16 @@
5857
</head>
5958

6059
<body>
60+
<div id="nowebgpu">
61+
<div>
62+
WebGPU is only available on Chrome, <a target="_blank" rel="noopener"
63+
href="https://www.mozilla.org/en-US/firefox/nightly/notes/">Firefox Nightly</a>, and <a target="_blank"
64+
rel="noopener" href="https://developer.apple.com/safari/technology-preview/">Safary Technology Preview</a>.
65+
</div>
66+
</div>
6167
<canvas id="canvas" width="800" height="800">
6268
Oops ... your browser doesn't support the HTML5 canvas element
6369
</canvas>
64-
65-
6670
</body>
6771

6872
</html>

src/main.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,15 @@ const renderPasses = [
333333
new RenderPass(vert, frag0, null),
334334
];
335335

336-
await points.init(renderPasses);
336+
if (await points.init(renderPasses)) {
337+
points.fitWindow = true;
338+
update();
339+
} else {
340+
const el = document.getElementById('nowebgpu');
341+
el.classList.toggle('show');
342+
}
343+
337344

338-
points.fitWindow = true;
339345

340346
points.canvas.addEventListener('click', _ => {
341347
if (pauseClickTimeout) {

style.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,29 @@ body {
55
width: 100%;
66
height: 100%;
77
position: absolute;
8+
}
9+
10+
#nowebgpu a,
11+
#info a {
12+
color: #488553;
13+
}
14+
15+
16+
#nowebgpu {
17+
display : none;
18+
position : absolute;
19+
width : 100%;
20+
height : 800px;
21+
align-items : center;
22+
justify-content: center;
23+
color : white;
24+
z-index : 100;
25+
}
26+
27+
#nowebgpu>div {
28+
width: 50%;
29+
}
30+
31+
#nowebgpu.show {
32+
display: flex;
833
}

0 commit comments

Comments
 (0)