index.vwf.yaml 3.9 KB

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