index.vwf.yaml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. transparent: true
  53. raycaster-listener:
  54. extends: http://vwf.example.com/aframe/app-raycaster-listener-component.vwf
  55. type: "component"
  56. cursor-listener:
  57. extends: http://vwf.example.com/aframe/app-cursor-listener-component.vwf
  58. type: "component"
  59. events:
  60. clickEvent:
  61. intersectEvent:
  62. clearIntersectEvent:
  63. methods:
  64. clickEventMethod:
  65. body: |
  66. if (this.clickable) {
  67. let genColor = this.generateColor();
  68. this.material.color = genColor
  69. }
  70. intersectEventMethod:
  71. body: |
  72. if (this.clickable) {
  73. this.material.opacity = 0.7
  74. }
  75. clearIntersectEventMethod:
  76. body: |
  77. if (this.clickable) {
  78. this.material.opacity = 1.0
  79. }
  80. generateColor:
  81. body: |
  82. var letters = '0123456789ABCDEF';
  83. var color = '#';
  84. for (var i = 0; i < 6; i++) {
  85. color += letters[Math.floor(this.random() * 16)];
  86. } return color
  87. scripts:
  88. - |
  89. this.clickEvent = function(){
  90. this.clickEventMethod();
  91. }
  92. this.intersectEvent = function(){
  93. this.intersectEventMethod();
  94. }
  95. this.clearIntersectEvent = function(){
  96. this.clearIntersectEventMethod();
  97. }
  98. sphere:
  99. extends: http://vwf.example.com/aframe/asphere.vwf
  100. properties:
  101. position: "1 1.25 -4"
  102. radius: 1
  103. children:
  104. material:
  105. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  106. properties:
  107. color: "#e0e014"
  108. wireframe: true
  109. box2:
  110. extends: http://vwf.example.com/aframe/abox.vwf
  111. properties:
  112. position: "2 -0.75 0"
  113. depth: 1
  114. children:
  115. material:
  116. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  117. properties:
  118. color: "#2167a5"
  119. interpolation:
  120. extends: http://vwf.example.com/aframe/interpolation-component.vwf
  121. properties:
  122. enabled: true
  123. methods:
  124. run:
  125. body: |
  126. var time = vwf.now;
  127. let rot = this.rotation; //AFRAME.utils.coordinates.parse(this.rotation);
  128. let pos = this.position; //AFRAME.utils.coordinates.parse(this.position);
  129. this.position = [pos[0], pos[1], Math.sin(time)];
  130. this.rotation = [rot[0], rot[1], Math.sin(time)*100];
  131. this.future( 0.01 ).run(); // schedule the next step
  132. methods:
  133. initialize:
  134. body: |
  135. var runBox = vwf_view.kernel.find("", "/sphere/box2")[0];
  136. console.log(runBox);
  137. vwf_view.kernel.callMethod(runBox, "run");