回答編集履歴
1
ソースコードを更に簡略化
answer
CHANGED
@@ -19,33 +19,28 @@
|
|
19
19
|
```
|
20
20
|
|
21
21
|
```javascript
|
22
|
-
|
22
|
+
var text = new Blotter.Text("こんにちは", {
|
23
23
|
family : "serif",
|
24
24
|
size : 120,
|
25
25
|
fill : "#171717"
|
26
26
|
});
|
27
27
|
|
28
|
-
const mainImageSource = [
|
29
|
-
Blotter.Assets.Shaders.Noise3D,
|
30
|
-
|
28
|
+
var mainImageSource = document.getElementById("fs").textContent;
|
31
|
-
].join("\n");
|
32
|
-
|
33
|
-
|
29
|
+
var material = new Blotter.ShaderMaterial(mainImageSource, {
|
34
30
|
uniforms : {
|
35
31
|
mouseX: {type :"1f", value : 0.0},
|
36
32
|
mouseY: {type :"1f", value : 0.0}
|
37
33
|
}
|
38
34
|
});
|
39
35
|
|
40
|
-
|
36
|
+
var blotter = new Blotter(material, { texts : text });
|
41
|
-
|
37
|
+
var scope = blotter.forText(text);
|
42
38
|
scope.appendTo(document.body);
|
43
39
|
|
44
40
|
scope.on("mousemove", function(mousePosition) {
|
45
41
|
scope.material.uniforms.mouseX.value = mousePosition.x;
|
46
42
|
scope.material.uniforms.mouseY.value = mousePosition.y;
|
47
43
|
});
|
48
|
-
|
49
44
|
```
|
50
45
|
|
51
46
|
<実行結果>
|