質問編集履歴

1

ソースコード記入

2020/10/08 11:11

投稿

sugimoto
sugimoto

スコア1

test CHANGED
File without changes
test CHANGED
@@ -49,3 +49,165 @@
49
49
 
50
50
 
51
51
  three.jsのバージョンはr78です。
52
+
53
+
54
+
55
+ ---
56
+
57
+ <!DOCTYPE html>
58
+
59
+
60
+
61
+ <html>
62
+
63
+
64
+
65
+ <head>
66
+
67
+ <title>3d world</title>
68
+
69
+ <!-- three.js読み込み -->
70
+
71
+ <script type="text/javascript" src="libs/three.js"></script>
72
+
73
+
74
+
75
+ <script type="text.javascript" src="fonts/helvetiker_regular.typeface.js"></script>
76
+
77
+ <style>
78
+
79
+ body {
80
+
81
+ /* ページ全体を使用するためにmarginを0に設定して
82
+
83
+ overflowをhiddenに設定する */
84
+
85
+ margin: 0;
86
+
87
+ overflow: hidden;
88
+
89
+ }
90
+
91
+ </style>
92
+
93
+ </head>
94
+
95
+ <body>
96
+
97
+
98
+
99
+ <!-- 出力を保持するDiv -->
100
+
101
+ <div id="WebGL-output">
102
+
103
+ </div>
104
+
105
+
106
+
107
+ <!-- サンプルを実行するJavaScriptコード -->
108
+
109
+ <script type="text/javascript">
110
+
111
+
112
+
113
+ // すべての読み込みが終わってからThree.js関連の処理を実行します
114
+
115
+ function init() {
116
+
117
+ // Three.js関係の処理を以下に追加します
118
+
119
+ var scene = new THREE.Scene();
120
+
121
+
122
+
123
+ var camera = new THREE.PerspectiveCamera(45, window.innerWidth/window.innerHeight, 0.1, 1000);
124
+
125
+
126
+
127
+ var renderer = new THREE.WebGLRenderer();
128
+
129
+ renderer.setClearColor(new THREE.Color(0xeeeeee));
130
+
131
+ renderer.setSize(window.innerWidth, window.innerHeight);
132
+
133
+
134
+
135
+ camera.position.set(100,300,600);
136
+
137
+ camera.lookAt(new THREE.Vector3(400, 0, -300));
138
+
139
+
140
+
141
+ var fontLoader = new THREE.FontLoader();
142
+
143
+ fontLoader.load('fonts/helvetiker_regular.typeface.js', function(font){
144
+
145
+ init();
146
+
147
+ });
148
+
149
+
150
+
151
+ var options = {
152
+
153
+ size: 90,
154
+
155
+ height: 90,
156
+
157
+ weight: 'normal',
158
+
159
+ font: font,
160
+
161
+ bevelThickness: 9,
162
+
163
+ bevelSize: 4,
164
+
165
+ bevelSegments: 3,
166
+
167
+ bevelEnabled: true,
168
+
169
+ curveSgments: 12,
170
+
171
+ steps: 1
172
+
173
+ };
174
+
175
+
176
+
177
+ var text1 = createMesh(new THREE.TextGeometry("Learning", options));
178
+
179
+ text1.position.z = -100;
180
+
181
+ text1.position.y = 100;
182
+
183
+ scene.add(text1);
184
+
185
+
186
+
187
+ var text2 = createMesh(new THREE.TextGeometry("Three.js", options));
188
+
189
+ scene.add(text2);
190
+
191
+
192
+
193
+ document.getElementById("WebGL-output").appendChild(renderer.domElement);
194
+
195
+
196
+
197
+ renderer.render(scene, camera);
198
+
199
+ }
200
+
201
+ window.onload = init;
202
+
203
+
204
+
205
+ </script>
206
+
207
+ </body>
208
+
209
+ </html>
210
+
211
+
212
+
213
+ ---