質問するログイン新規登録

回答編集履歴

1

ソースコードを更に簡略化

2021/11/11 13:50

投稿

cx20
cx20

スコア4707

answer CHANGED
@@ -19,33 +19,28 @@
19
19
  ```
20
20
 
21
21
  ```javascript
22
- const text = new Blotter.Text("こんにちは", {
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
- document.getElementById("fs").textContent
28
+ var mainImageSource = document.getElementById("fs").textContent;
31
- ].join("\n");
32
-
33
- const material = new Blotter.ShaderMaterial(mainImageSource, {
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
- const blotter = new Blotter(material, { texts : text });
36
+ var blotter = new Blotter(material, { texts : text });
41
- const scope = blotter.forText(text);
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
  <実行結果>