You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cursor.ts 326B

1234567891011121314151617
  1. const cursorSvgs = {
  2. default: 'pointer',
  3. resize: 'resize',
  4. grab: 'grab',
  5. }
  6. class Cursor {
  7. setCursor(cursor: keyof typeof cursorSvgs, rotation = 0) {
  8. document.body.style.setProperty('cursor', `url(${cursorSvgs[cursor]}.svg)`)
  9. }
  10. resetCursor() {
  11. this.setCursor('default')
  12. }
  13. }
  14. export default new Cursor()