Update index.html
Browse files- index.html +10 -5
index.html
CHANGED
@@ -40,6 +40,7 @@
|
|
40 |
<form id="uploadForm">
|
41 |
<input type="file" id="imageInput" accept="image/*">
|
42 |
<button type="button" onclick="processImage()">画像を処理</button>
|
|
|
43 |
</form>
|
44 |
<div id="settings">
|
45 |
<label>
|
@@ -69,11 +70,10 @@
|
|
69 |
let cubes = [];
|
70 |
let animationFrameId;
|
71 |
|
72 |
-
function processImage() {
|
73 |
const fileInput = document.getElementById('imageInput');
|
74 |
-
const file = fileInput.files[0];
|
75 |
-
|
76 |
-
|
77 |
const img = new Image();
|
78 |
img.onload = () => {
|
79 |
const scale = 0.1;
|
@@ -84,7 +84,12 @@
|
|
84 |
create3DScene();
|
85 |
document.getElementById('replayButton').style.display = 'block';
|
86 |
};
|
87 |
-
img.src = URL.createObjectURL(file);
|
|
|
|
|
|
|
|
|
|
|
88 |
}
|
89 |
|
90 |
function create3DScene() {
|
|
|
40 |
<form id="uploadForm">
|
41 |
<input type="file" id="imageInput" accept="image/*">
|
42 |
<button type="button" onclick="processImage()">画像を処理</button>
|
43 |
+
<button type="button" onclick="useExampleImage()">例の画像を使用</button> <!-- 新しく追加したボタン -->
|
44 |
</form>
|
45 |
<div id="settings">
|
46 |
<label>
|
|
|
70 |
let cubes = [];
|
71 |
let animationFrameId;
|
72 |
|
73 |
+
function processImage(imageSrc = null) {
|
74 |
const fileInput = document.getElementById('imageInput');
|
75 |
+
const file = imageSrc ? null : fileInput.files[0];
|
76 |
+
|
|
|
77 |
const img = new Image();
|
78 |
img.onload = () => {
|
79 |
const scale = 0.1;
|
|
|
84 |
create3DScene();
|
85 |
document.getElementById('replayButton').style.display = 'block';
|
86 |
};
|
87 |
+
img.src = imageSrc || URL.createObjectURL(file);
|
88 |
+
}
|
89 |
+
|
90 |
+
function useExampleImage() {
|
91 |
+
const exampleImagePath = 'ex.png'; // 例の画像のパス
|
92 |
+
processImage(exampleImagePath);
|
93 |
}
|
94 |
|
95 |
function create3DScene() {
|