index.vwf.yaml 3.2 KB

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