index.vwf.yaml 3.3 KB

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