avatar.vwf.yaml 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. "height": 2
  18. },
  19. "children": {
  20. "avatarNameNode": {
  21. "extends": "http://vwf.example.com/aframe/atext.vwf",
  22. "properties": {
  23. "color": myColor,
  24. "value": this.id,
  25. "side": "double",
  26. "rotation": [0, 180, 0],
  27. "position": [0, 1, 0.5]
  28. }
  29. }
  30. }
  31. }
  32. //let cursor =
  33. //{
  34. // "id": 'cursor-' + this.id,
  35. // "extends": "http://vwf.example.com/aframe/acursor.vwf",
  36. //}
  37. let cursorVis =
  38. {
  39. "id": 'myCursor-' + this.id,
  40. "extends": "http://vwf.example.com/aframe/aentity.vwf",
  41. "properties": {},
  42. "children": {
  43. "line": {
  44. "extends": "http://vwf.example.com/aframe/lineComponent.vwf",
  45. "type": "component",
  46. "properties": {
  47. "start": "0 0 -1",
  48. "end": "0 0 -3",
  49. "color": myColor
  50. }
  51. }
  52. }
  53. }
  54. let camera =
  55. {
  56. "id": 'camera-' + this.id,
  57. "extends": "http://vwf.example.com/aframe/acamera.vwf",
  58. "properties": {
  59. "look-controls-enabled": false,
  60. "wasd-controls": false,
  61. "userHeight": 0,
  62. }
  63. }
  64. let interpolation =
  65. {
  66. "extends": "http://vwf.example.com/aframe/interpolation-component.vwf",
  67. "type": "component",
  68. "properties": {
  69. "enabled": true,
  70. "duration": 50,
  71. "deltaPos": 0,
  72. "deltaRot": 0
  73. }
  74. }
  75. this.children.create( "interpolation", interpolation );
  76. this.children.create( "avatarBody", newNode );
  77. this.children.create( "avatarCursor", cursorVis );
  78. this.children.create( "avatarCamera", camera );
  79. //this.interpolation = "50ms";
  80. //vwf_view.kernel.createChild(this.id, "avatarCursor", cursorVis);
  81. getRandomColor:
  82. body: |
  83. var letters = '0123456789ABCDEF';
  84. var color = '#';
  85. for (var i = 0; i < 6; i++) {
  86. color += letters[Math.floor(this.random() * 16)]; }
  87. return color;