rotating.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. class rotating {
  2. #sideways;
  3. #up_down;
  4. static get top() {
  5. return 1;
  6. }
  7. static get bottom() {
  8. return -1;
  9. }
  10. static get left() {
  11. return -1;
  12. }
  13. static get right() {
  14. return 1;
  15. }
  16. constructor() {
  17. this.stop();
  18. }
  19. stop() {
  20. this.#sideways = 0;
  21. this.#up_down = 0;
  22. }
  23. add_top() {
  24. this.#up_down = rotating.top;
  25. }
  26. add_bottom() {
  27. this.#up_down = rotating.bottom;
  28. }
  29. add_left() {
  30. this.#sideways = rotating.left;
  31. }
  32. add_right() {
  33. this.#sideways = rotating.right;
  34. }
  35. stop_sideways() {
  36. this.#sideways = 0;
  37. }
  38. stop_up_down() {
  39. this.#up_down = 0;
  40. }
  41. get is_left() {
  42. return this.#sideways === rotating.left;
  43. }
  44. get is_right() {
  45. return this.#sideways === rotating.right;
  46. }
  47. get is_top() {
  48. return this.#up_down === rotating.top;
  49. }
  50. get is_bottom() {
  51. return this.#up_down === rotating.bottom;
  52. }
  53. }
  54. export { rotating }