index.vwf.yaml 4.3 KB

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