index.vwf.yaml 4.4 KB

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