avatar.vwf.yaml 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # avatar
  2. # Copyright 2017 Krestianstvo.org project
  3. ---
  4. extends: http://vwf.example.com/aframe/aentity.vwf
  5. type: "avatar"
  6. properties:
  7. methods:
  8. createAvatarBody:
  9. body: |
  10. let myColor = this.getRandomColor();
  11. var newNode =
  12. {
  13. "extends": "http://vwf.example.com/aframe/abox.vwf",
  14. "properties": {
  15. "color": myColor,
  16. "position": [0,0,0.5]
  17. },
  18. "children": {
  19. "avatarNameNode": {
  20. "extends": "http://vwf.example.com/aframe/atext.vwf",
  21. "properties": {
  22. "color": myColor,
  23. "value": this.id,
  24. "side": "double",
  25. "rotation": [0, 180, 0],
  26. "position": [0, 1, 0.5]
  27. }
  28. }
  29. }
  30. }
  31. //let cursor =
  32. //{
  33. // "id": 'cursor-' + this.id,
  34. // "extends": "http://vwf.example.com/aframe/acursor.vwf",
  35. //}
  36. let cursorVis =
  37. {
  38. "extends": "http://vwf.example.com/aframe/abox.vwf",
  39. "properties": {
  40. "color": myColor,
  41. "opacity": 0.3,
  42. "transparent": true,
  43. "depth": 3,
  44. "width": 0.02,
  45. "height": 0.02,
  46. "rotation": [0, 180, 0],
  47. "position": [0, 0, -2]
  48. }
  49. }
  50. let camera =
  51. {
  52. "id": 'camera-' + this.id,
  53. "extends": "http://vwf.example.com/aframe/acamera.vwf",
  54. "properties": {
  55. "look-controls-enabled": false,
  56. "wasd-controls": false,
  57. "userHeight": 0,
  58. }
  59. }
  60. let interpolation =
  61. {
  62. "id": 'interpolation-' + this.id,
  63. "extends": "http://vwf.example.com/aframe/interpolation-component.vwf",
  64. "type": "component",
  65. "properties": {
  66. "enabled": true,
  67. "duration": 50,
  68. "deltaPos": 0,
  69. "deltaRot": 0
  70. }
  71. }
  72. //this.interpolation = "50ms";
  73. this.children.create( "interpolation", interpolation );
  74. this.children.create( "avatarBody", newNode );
  75. this.children.create( "avatarCursor", cursorVis );
  76. this.children.create( "avatarCamera", camera );
  77. getRandomColor:
  78. body: |
  79. var letters = '0123456789ABCDEF';
  80. var color = '#';
  81. for (var i = 0; i < 6; i++) {
  82. color += letters[Math.floor(this.random() * 16)]; }
  83. return color;