index.vwf.yaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. class: "clickable intersectable"
  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. let genColor = this.generateColor();
  79. this.material.color = genColor
  80. intersectEventMethod:
  81. body: |
  82. this.material.opacity = 0.7
  83. clearIntersectEventMethod:
  84. body: |
  85. this.material.opacity = 1.0
  86. generateColor:
  87. body: |
  88. var letters = '0123456789ABCDEF';
  89. var color = '#';
  90. for (var i = 0; i < 6; i++) {
  91. color += letters[Math.floor(this.random() * 16)];
  92. } return color
  93. sphere:
  94. extends: http://vwf.example.com/aframe/asphere.vwf
  95. properties:
  96. position: "1 1.25 -4"
  97. radius: 1
  98. children:
  99. material:
  100. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  101. properties:
  102. color: "#e0e014"
  103. wireframe: true
  104. box2:
  105. extends: http://vwf.example.com/aframe/abox.vwf
  106. properties:
  107. position: "2 -0.75 0"
  108. depth: 1
  109. children:
  110. material:
  111. extends: http://vwf.example.com/aframe/aMaterialComponent.vwf
  112. properties:
  113. color: "#2167a5"
  114. interpolation:
  115. extends: http://vwf.example.com/aframe/interpolation-component.vwf
  116. properties:
  117. enabled: true
  118. methods:
  119. run:
  120. body: |
  121. var time = vwf.now;
  122. let rot = this.rotation; //AFRAME.utils.coordinates.parse(this.rotation);
  123. let pos = this.position; //AFRAME.utils.coordinates.parse(this.position);
  124. this.position = [pos[0], pos[1], Math.sin(time)];
  125. this.rotation = [rot[0], rot[1], Math.sin(time)*100];
  126. this.future( 0.01 ).run();
  127. methods:
  128. initialize:
  129. body: |
  130. var runBox = vwf.find("", "/sphere/box2")[0];
  131. console.log(runBox);
  132. vwf.callMethod(runBox, "run");