index.vwf.yaml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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. transparent: true
  7. assets: "assets.json"
  8. children:
  9. assetBG:
  10. extends: http://vwf.example.com/aframe/a-asset-image-item.vwf
  11. properties:
  12. itemID: "bg"
  13. itemSrc: "/assets/bg.jpg"
  14. assetSky:
  15. extends: http://vwf.example.com/aframe/a-asset-image-item.vwf
  16. properties:
  17. itemID: "sky"
  18. itemSrc: "/assets/skyes/sky3.jpg"
  19. assetBG2:
  20. extends: http://vwf.example.com/aframe/a-asset-image-item.vwf
  21. properties:
  22. itemID: "bg2"
  23. itemSrc: "/assets/checker.jpg"
  24. assetPlaneObj:
  25. extends: http://vwf.example.com/aframe/a-asset-item.vwf
  26. properties:
  27. itemID: "plane-obj"
  28. itemSrc: "/assets/models/plane/PUSHILIN_Plane.obj"
  29. assetPlaneMtl:
  30. extends: http://vwf.example.com/aframe/a-asset-item.vwf
  31. properties:
  32. itemID: "plane-mtl"
  33. itemSrc: "/assets/models/plane/PUSHILIN_Plane.mtl"
  34. myLight:
  35. extends: http://vwf.example.com/aframe/alight.vwf
  36. properties:
  37. type: "directional"
  38. intensity: 0.5
  39. position: "0.5 2.0 1.0"
  40. castShadow: true
  41. myLight2:
  42. extends: http://vwf.example.com/aframe/alight.vwf
  43. properties:
  44. type: "ambient"
  45. intensity: 0.5
  46. model:
  47. extends: http://vwf.example.com/aframe/aobjmodel.vwf
  48. properties:
  49. src: "#plane-obj"
  50. mtl: "#plane-mtl"
  51. position: "-1.2 1.7 -2.5"
  52. rotation: "0 -45 0"
  53. scale: "0.5 0.5 0.5"
  54. children:
  55. shadow:
  56. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  57. properties:
  58. cast: true
  59. spaceText:
  60. extends: http://vwf.example.com/aframe/atext.vwf
  61. properties:
  62. value: "Virtual World Framework & A-Frame"
  63. color: "#ddd"
  64. position: "-2 2.5 -2"
  65. spaceText2:
  66. extends: http://vwf.example.com/aframe/atext.vwf
  67. properties:
  68. value: "Project by Krestianstvo.org"
  69. color: "#aaa"
  70. position: "1 3 -4"
  71. boxAnim:
  72. extends: http://vwf.example.com/aframe/abox.vwf
  73. properties:
  74. position: "0 0 -3"
  75. rotation: "0 0 0"
  76. depth: 2
  77. height: 1
  78. width: 1
  79. children:
  80. material:
  81. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  82. properties:
  83. color: "#3c7249"
  84. box:
  85. extends: http://vwf.example.com/aframe/abox.vwf
  86. properties:
  87. position: "-1 0.5 -3"
  88. rotation: "0 -30 0"
  89. depth: 2
  90. height: 1
  91. width: 1
  92. clickable: true
  93. children:
  94. material:
  95. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  96. properties:
  97. color: "#3c7249"
  98. raycaster-listener:
  99. extends: http://vwf.example.com/aframe/app-raycaster-listener-component.vwf
  100. type: "component"
  101. cursor-listener:
  102. extends: http://vwf.example.com/aframe/app-cursor-listener-component.vwf
  103. type: "component"
  104. shadow:
  105. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  106. properties:
  107. cast: true
  108. receive: true
  109. events:
  110. clickEvent:
  111. intersectEvent:
  112. clearIntersectEvent:
  113. methods:
  114. clickEventMethod:
  115. body: |
  116. if (this.clickable) {
  117. let genColor = this.generateColor();
  118. this.material.color = genColor
  119. }
  120. intersectEventMethod:
  121. body: |
  122. if (this.clickable) {
  123. this.rotation = "0 -90 0"
  124. }
  125. clearIntersectEventMethod:
  126. body: |
  127. if (this.clickable) {
  128. this.rotation = "0 -30 0"
  129. }
  130. generateColor:
  131. body: |
  132. var letters = '0123456789ABCDEF';
  133. var color = '#';
  134. for (var i = 0; i < 6; i++) {
  135. color += letters[Math.floor(this.random() * 16)];
  136. } return color
  137. scripts:
  138. - |
  139. this.clickEvent = function(){
  140. this.clickEventMethod();
  141. }
  142. this.intersectEvent = function(){
  143. this.intersectEventMethod();
  144. }
  145. this.clearIntersectEvent = function(){
  146. this.clearIntersectEventMethod();
  147. }
  148. sphere:
  149. extends: http://vwf.example.com/aframe/asphere.vwf
  150. properties:
  151. position: "1 1.25 -4"
  152. radius: 1
  153. children:
  154. material:
  155. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  156. properties:
  157. color: "#e0e014"
  158. wireframe: true
  159. box2:
  160. extends: http://vwf.example.com/aframe/abox.vwf
  161. properties:
  162. position: "2 -0.75 0"
  163. depth: 1
  164. children:
  165. material:
  166. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  167. properties:
  168. color: "#2167a5"
  169. src: "#bg"
  170. shadow:
  171. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  172. properties:
  173. cast: true
  174. interpolation:
  175. extends: http://vwf.example.com/aframe/interpolation-component.vwf
  176. properties:
  177. enabled: true
  178. deltaPos: 0.001
  179. deltaRot: 0.1
  180. methods:
  181. run:
  182. body: |
  183. var time = vwf.now;
  184. let pos = AFRAME.utils.coordinates.parse(this.position);
  185. this.position = [pos.x, pos.y, Math.sin(time)]
  186. this.future( 0.01 ).run(); // schedule the next step
  187. sky:
  188. extends: http://vwf.example.com/aframe/asky.vwf
  189. properties:
  190. children:
  191. material:
  192. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  193. properties:
  194. src: "#sky"
  195. side: "back"
  196. fog: false
  197. groundPlane:
  198. extends: http://vwf.example.com/aframe/aplane.vwf
  199. properties:
  200. height: 50
  201. width: 50
  202. rotation: "-90 0 0"
  203. children:
  204. material:
  205. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  206. properties:
  207. repeat: "10 10"
  208. color: "white"
  209. src: "#bg2"
  210. shadow:
  211. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  212. properties:
  213. receive: true
  214. methods:
  215. initialize:
  216. body: |
  217. var runBox = vwf_view.kernel.find("", "/sphere/box2")[0];
  218. console.log(runBox);
  219. vwf_view.kernel.callMethod(runBox, "run");