index.vwf.yaml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # A-Frame & VWF simple scene
  2. # Copyright 2017 Krestianstvo.org project
  3. ---
  4. extends: http://vwf.example.com/aframe/ascene.vwf
  5. properties:
  6. fog: "type: linear; color: #ECECEC; far: 30; near: 0"
  7. assets: "assets.json"
  8. children:
  9. myLight:
  10. extends: http://vwf.example.com/aframe/alight.vwf
  11. properties:
  12. type: "point"
  13. color: "white"
  14. position: "0 10 5"
  15. rotation: "0 0 0"
  16. model:
  17. extends: http://vwf.example.com/aframe/acolladamodel.vwf
  18. properties:
  19. src: "#plane"
  20. position: "-1.0 1.7 -3"
  21. rotation: "0 -45 0"
  22. scale: "10 10 10"
  23. spaceText:
  24. extends: http://vwf.example.com/aframe/atext.vwf
  25. properties:
  26. value: "Virtual World Framework & A-Frame"
  27. color: "#ddd"
  28. position: "-2 2.5 -2"
  29. spaceText2:
  30. extends: http://vwf.example.com/aframe/atext.vwf
  31. properties:
  32. value: "Project by Krestianstvo.org"
  33. color: "#aaa"
  34. position: "1 3 -4"
  35. boxAnim:
  36. extends: http://vwf.example.com/aframe/abox.vwf
  37. properties:
  38. position: "0 0 -3"
  39. rotation: "0 0 0"
  40. color: "#3c7249"
  41. depth: 2
  42. height: 1
  43. width: 1
  44. methods:
  45. createGizmo:
  46. body: |
  47. let gizmoNode =
  48. {
  49. "extends": "http://vwf.example.com/aframe/gizmoComponent.vwf",
  50. "type": "component",
  51. "properties":
  52. {
  53. "mode": "translate"
  54. }
  55. }
  56. this.children.create("gizmo", gizmoNode);
  57. box:
  58. extends: http://vwf.example.com/aframe/abox.vwf
  59. properties:
  60. position: "-1 0.5 -3"
  61. rotation: "0 -30 0"
  62. color: "#3c7249"
  63. depth: 2
  64. height: 1
  65. width: 1
  66. clickable: true
  67. children:
  68. raycaster-listener:
  69. extends: http://vwf.example.com/aframe/app-raycaster-listener-component.vwf
  70. type: "component"
  71. cursor-listener:
  72. extends: http://vwf.example.com/aframe/app-cursor-listener-component.vwf
  73. type: "component"
  74. events:
  75. clickEvent:
  76. intersectEvent:
  77. clearIntersectEvent:
  78. methods:
  79. clickEventMethod:
  80. body: |
  81. if (this.clickable) {
  82. let genColor = this.generateColor();
  83. this.color = genColor
  84. }
  85. intersectEventMethod:
  86. body: |
  87. if (this.clickable) {
  88. this.rotation = "0 -90 0"
  89. }
  90. clearIntersectEventMethod:
  91. body: |
  92. if (this.clickable) {
  93. this.rotation = "0 -30 0"
  94. }
  95. generateColor:
  96. body: |
  97. var letters = '0123456789ABCDEF';
  98. var color = '#';
  99. for (var i = 0; i < 6; i++) {
  100. color += letters[Math.floor(this.random() * 16)];
  101. } return color
  102. scripts:
  103. - |
  104. this.clickEvent = function(){
  105. this.clickEventMethod();
  106. }
  107. this.intersectEvent = function(){
  108. this.intersectEventMethod();
  109. }
  110. this.clearIntersectEvent = function(){
  111. this.clearIntersectEventMethod();
  112. }
  113. sphere:
  114. extends: http://vwf.example.com/aframe/asphere.vwf
  115. properties:
  116. position: "1 1.25 -4"
  117. color: "#e0e014"
  118. radius: 1
  119. wireframe: true
  120. children:
  121. box2:
  122. extends: http://vwf.example.com/aframe/abox.vwf
  123. properties:
  124. src: "#bg"
  125. position: "2 -0.75 0"
  126. color: "#2167a5"
  127. depth: 1
  128. children:
  129. interpolation:
  130. extends: http://vwf.example.com/aframe/interpolation-component.vwf
  131. properties:
  132. enabled: true
  133. duration: 50
  134. deltaPos: 0.1
  135. deltaRot: 1
  136. methods:
  137. run:
  138. body: |
  139. var time = vwf.now;
  140. let pos = AFRAME.utils.coordinates.parse(this.position);
  141. this.position = [pos.x, pos.y, Math.sin(time)]
  142. this.future( 0.01 ).run(); // schedule the next step
  143. sky:
  144. extends: http://vwf.example.com/aframe/asky.vwf
  145. properties:
  146. color: "#ECECEC"
  147. src: "#sky"
  148. fog: false
  149. groundPlane:
  150. extends: http://vwf.example.com/aframe/aplane.vwf
  151. properties:
  152. height: 50
  153. width: 50
  154. repeat: "10 10"
  155. rotation: "-90 0 0"
  156. color: "white"
  157. wireframe: false
  158. src: "#bg2"
  159. methods:
  160. initialize:
  161. body: |
  162. var runBox = vwf_view.kernel.find("", "/sphere/box2")[0];
  163. console.log(runBox);
  164. vwf_view.kernel.callMethod(runBox, "run");