-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
99 lines (93 loc) · 3.41 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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script type="text/javascript" src="fragmen.js"></script>
<script>
window.addEventListener('DOMContentLoaded', ()=>{
const fragmentShaderSource = `
precision mediump float;
uniform vec2 resolution;
uniform vec2 mouse;
uniform float time;
uniform sampler2D backbuffer;
const vec3 pinkColor = vec3(1.0, 0.1, 0.5);
const vec3 blueColor = vec3(0.1, 0.3, 0.9);
float neon(vec2 p, float power, float width, float height, float speed){
float x = cos(abs(p.x * width));
float y = power / abs(p.y + sin(p.x * 25.0 + time * speed) * height);
return max(x * y, 0.0);
}
void main(){
vec2 p = (gl_FragCoord.xy * 2.0 - resolution) / min(resolution.x, resolution.y);
vec2 m = mouse * 2.0 - 1.0;
float t = min(time, 2.0) * 0.5;
p = p * abs(atan(p.y / p.x));
float a = neon(p, 0.2, 5.0, 0.25 + abs(m.x), 0.75);
float b = neon(p, 0.5, 2.5, 0.5 + abs(m.y), 0.25);
gl_FragColor = vec4((pinkColor * a + blueColor * b) * t, 1.0);
}`;
const backscreen = document.getElementById('insert_target');
const backscreenOption = {
target: backscreen,
eventTarget: window,
mouse: true,
resize: true,
escape: true
};
const content = document.getElementById('insert_target_content');
const contentOption = {
target: content,
eventTarget: null,
mouse: true,
resize: true,
escape: false
};
let frag = new Fragmen(backscreenOption).render(fragmentShaderSource);
let frag_content = new Fragmen(contentOption).render(fragmentShaderSource);
}, false);
</script>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#insert_target {
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
top: 0px;
left: 0px;
}
#insert_target_content {
width: 50%;
height: 300px;
overflow: hidden;
box-shadow: 0px 0px 0px 2px gray;
}
#content {
background-color: rgba(64, 64, 64, 0.5);
color: silver;
margin: 0px;
padding: 50px;
position: absolute;
}
</style>
<title>test html</title>
</head>
<body>
<div id="insert_target"></div>
<div id="content">
<h1>content</h1>
<p>content text. content text. content text. content text. content text.</p>
<p>content text. content text. content text. content text. content text.</p>
<div id="insert_target_content"></div>
<p>content text. content text. content text. content text. content text.</p>
<p>content text. content text. content text. content text. content text.</p>
</div>
</body>
</html>