-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.html
More file actions
152 lines (134 loc) · 4.88 KB
/
index.html
File metadata and controls
152 lines (134 loc) · 4.88 KB
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
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fluid simulation</title>
<style>
* {
font-family: 'Roboto', sans-serif;
}
/* スクロールバーを表示しないようにする */
html, body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden; /* スクロールバーを非表示にする */
}
canvas {
border: 1px solid #fff; /* キャンバスの境界線 */
}
#slider-container {
position: fixed; /* 固定位置 */
top: 0; /* 上端に配置 */
left: 0; /* 左端に配置 */
width: 300px; /* スライダーの幅 */
margin: 20px; /* 少し余白を追加 */
}
#slider-wrapper {
display: flex;
align-items: center; /* 水平方向で中央揃えにする */
height: 100%; /* 親要素の高さを100%に設定 */
margin-left: 10px;
}
#slider {
width: 200px;
height: 14px;
}
#slider .noUi-handle {
height: 24px;
width: 24px;
top: -6px;
right: -12px; /* half the width */
border-radius: 12px;
}
#slider .noUi-handle:before, #slider .noUi-handle:after {
display: none;
}
#slider-value, #slider-text, #thread-count {
font-family: 'Roboto', sans-serif;
font-size: 15px;
color: white;
margin-left: 15px;
}
#slider-text {
width: 100%;
margin-bottom: 10px;
margin-left: 10px;
font-weight: bold;
}
#reset-button {
margin-top: 15px;
margin-left: 10px;
padding: 8px 16px;
background-color: black;
color: white;
border: none;
border-radius: 5px;
font-size: 15px;
font-weight:bold;
cursor: pointer;
transition: background-color 0.3s;
}
#thread-count {
margin-top: 10px;
margin-left: 10px;
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.8.1/nouislider.min.js" integrity="sha512-g/feAizmeiVKSwvfW0Xk3ZHZqv5Zs8PEXEBKzL15pM0SevEvoX8eJ4yFWbqakvRj7vtw1Q97bLzEpG2IVWX0Mg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/noUiSlider/15.8.1/nouislider.css" integrity="sha512-MKxcSu/LDtbIYHBNAWUQwfB3iVoG9xeMCm32QV5hZ/9lFaQZJVaXfz9aFa0IZExWzCpm7OWvp9zq9gVip/nLMg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<script src="https://cdn.jsdelivr.net/npm/lil-gui@0.20.0/dist/lil-gui.umd.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/lil-gui@0.20.0/dist/lil-gui.min.css" rel="stylesheet">
<script src="index.js" type="module"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
<style>
body {
margin: 0;
padding: 0;
}
.github-icon {
position: absolute;
top: 10px;
right: 10px;
font-size: 40px;
color: white;
}
</style>
</head>
<body>
<div id="slider-container">
<div id="slider-text">Number of particles (reset to change)</div>
<div id="slider-wrapper">
<div id="slider"></div> <!-- スライダー -->
<div id="slider-value"></div> <!-- 値表示 -->
</div>
<button id="reset-button">Reset</button>
<div id="thread-count"></div>
</div>
<script>
const slider = document.getElementById('slider');
const sliderValue = document.getElementById('slider-value');
start = 10000;
sliderValue.textContent = start;
noUiSlider.create(slider, {
range: {
min: 3000, // 最小値
max: 30000 // 最大値
},
step: 500, // 刻み幅
start: start,
connect: [true, false], // 左側を塗りつぶす(つまみが1つのみ)
animate: false
});
slider.noUiSlider.on('update', function(values, handle) {
sliderValue.textContent = Math.floor(values[0]); // 現在の値を表示
});
</script>
<a href="https://github.com/matsuoka-601/wasm-fluid-simulation" class="github-icon" target="_blank">
<i class="fab fa-github"></i>
</a>
<canvas id="canvas"></canvas>
</body>
</html>