index.vwf.yaml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. events:
  31. clickEvent:
  32. methods:
  33. clickEventMethod:
  34. body: |
  35. if (this.clickable) {
  36. let genColor = this.generateColor();
  37. this.color = genColor
  38. }
  39. generateColor:
  40. body: |
  41. var letters = '0123456789ABCDEF';
  42. var color = '#';
  43. for (var i = 0; i < 6; i++) {
  44. color += letters[Math.floor(this.random() * 16)];
  45. } return color
  46. scripts:
  47. - |
  48. this.clickEvent = function(){
  49. this.clickEventMethod();
  50. }
  51. sphere:
  52. extends: http://vwf.example.com/aframe/asphere.vwf
  53. properties:
  54. position: [1, 1.25, -4]
  55. color: "#e0e014"
  56. radius: 1
  57. wireframe: true
  58. children:
  59. box2:
  60. extends: http://vwf.example.com/aframe/abox.vwf
  61. properties:
  62. position: [2, -1.25, 0]
  63. color: "#2167a5"
  64. depth: 1
  65. interpolation: "50ms"
  66. methods:
  67. run:
  68. body: |
  69. var time = vwf.now;
  70. this.position = [this.position[0], this.position[1], Math.sin(time)]
  71. this.future( 0.01 ).run(); // schedule the next step
  72. sky:
  73. extends: http://vwf.example.com/aframe/asky.vwf
  74. properties:
  75. color: "#ECECEC"
  76. methods:
  77. initialize:
  78. body: |
  79. var runBox = vwf_view.kernel.find("", "/sphere/box2")[0];
  80. console.log(runBox);
  81. vwf_view.kernel.callMethod(runBox, "run");