index.vwf.yaml 3.4 KB

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