index.vwf.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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: "/defaults/assets/bg.jpg"
  14. assetSky:
  15. extends: http://vwf.example.com/aframe/a-asset-image-item.vwf
  16. properties:
  17. itemID: "sky"
  18. itemSrc: "/defaults/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: "/defaults/assets/checker.jpg"
  24. assetPlaneObj:
  25. extends: http://vwf.example.com/aframe/a-asset-item.vwf
  26. properties:
  27. itemID: "plane-obj"
  28. itemSrc: "/defaults/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: "/defaults/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. class: "hit"
  80. methods:
  81. hitstartEventMethod:
  82. body: |
  83. this.material.opacity = 0.7
  84. hitendEventMethod:
  85. body: |
  86. this.material.opacity = 1.0
  87. children:
  88. aabb-collider-listener:
  89. extends: http://vwf.example.com/aframe/app-aabb-collider-listener-component.vwf
  90. type: "component"
  91. material:
  92. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  93. properties:
  94. color: "#3c7249"
  95. box:
  96. extends: http://vwf.example.com/aframe/abox.vwf
  97. properties:
  98. position: "-1 0.5 -3"
  99. rotation: "0 -30 0"
  100. depth: 2
  101. height: 1
  102. width: 1
  103. class: "clickable intersectable"
  104. children:
  105. material:
  106. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  107. properties:
  108. color: "#3c7249"
  109. transparent: true
  110. raycaster-listener:
  111. extends: http://vwf.example.com/aframe/app-raycaster-listener-component.vwf
  112. type: "component"
  113. cursor-listener:
  114. extends: http://vwf.example.com/aframe/app-cursor-listener-component.vwf
  115. type: "component"
  116. shadow:
  117. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  118. properties:
  119. cast: true
  120. receive: true
  121. events:
  122. clickEvent:
  123. methods:
  124. clickEventMethod:
  125. body: |
  126. let genColor = this.generateColor();
  127. this.material.color = genColor
  128. intersectEventMethod:
  129. body: |
  130. this.material.opacity = 0.7
  131. clearIntersectEventMethod:
  132. body: |
  133. this.material.opacity = 1.0
  134. generateColor:
  135. body: |
  136. var letters = '0123456789ABCDEF';
  137. var color = '#';
  138. for (var i = 0; i < 6; i++) {
  139. color += letters[Math.floor(this.random() * 16)];
  140. } return color
  141. sphere:
  142. extends: http://vwf.example.com/aframe/asphere.vwf
  143. properties:
  144. position: "1 1.25 -4"
  145. radius: 1
  146. children:
  147. material:
  148. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  149. properties:
  150. color: "#e0e014"
  151. wireframe: true
  152. box2:
  153. extends: http://vwf.example.com/aframe/abox.vwf
  154. properties:
  155. position: "2 -0.75 0"
  156. depth: 1
  157. children:
  158. raycaster:
  159. extends: http://vwf.example.com/aframe/raycasterComponent.vwf
  160. type: "component"
  161. properties:
  162. recursive: false
  163. interval: 10
  164. far: 2
  165. objects: ".intersectable"
  166. material:
  167. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  168. properties:
  169. color: "#2167a5"
  170. src: "#bg"
  171. shadow:
  172. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  173. properties:
  174. cast: true
  175. interpolation:
  176. extends: http://vwf.example.com/aframe/interpolation-component.vwf
  177. properties:
  178. enabled: true
  179. deltaPos: 0.001
  180. deltaRot: 0.1
  181. methods:
  182. run:
  183. body: |
  184. var time = vwf.now;
  185. let pos = this.position; //AFRAME.utils.coordinates.parse(this.position);
  186. this.position = [pos[0], pos[1], Math.sin(time)]
  187. this.future( 0.01 ).run();
  188. sky:
  189. extends: http://vwf.example.com/aframe/asky.vwf
  190. properties:
  191. children:
  192. material:
  193. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  194. properties:
  195. src: "#sky"
  196. side: "back"
  197. fog: false
  198. groundPlane:
  199. extends: http://vwf.example.com/aframe/aplane.vwf
  200. properties:
  201. height: 50
  202. width: 50
  203. rotation: "-90 0 0"
  204. children:
  205. material:
  206. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  207. properties:
  208. repeat: "10 10"
  209. color: "white"
  210. src: "#bg2"
  211. shadow:
  212. extends: http://vwf.example.com/aframe/shadowComponent.vwf
  213. properties:
  214. receive: true
  215. methods:
  216. initialize:
  217. body: |
  218. var runBox = vwf.find("", "/sphere/box2")[0];
  219. console.log(runBox);
  220. vwf.callMethod(runBox, "run");