index.vwf.yaml 4.1 KB

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