index.vwf.yaml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. let pos = AFRAME.utils.coordinates.parse(this.position);
  71. this.position = [pos.x, pos.y, Math.sin(time)]
  72. this.future( 0.01 ).run(); // schedule the next step
  73. sky:
  74. extends: http://vwf.example.com/aframe/asky.vwf
  75. properties:
  76. color: "#ECECEC"
  77. methods:
  78. initialize:
  79. body: |
  80. var runBox = vwf_view.kernel.find("", "/sphere/box2")[0];
  81. console.log(runBox);
  82. vwf_view.kernel.callMethod(runBox, "run");