index.vwf.yaml 4.0 KB

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