18 lines
326 B
TypeScript
18 lines
326 B
TypeScript
|
const cursorSvgs = {
|
||
|
default: 'pointer',
|
||
|
resize: 'resize',
|
||
|
grab: 'grab',
|
||
|
}
|
||
|
|
||
|
class Cursor {
|
||
|
setCursor(cursor: keyof typeof cursorSvgs, rotation = 0) {
|
||
|
document.body.style.setProperty('cursor', `url(${cursorSvgs[cursor]}.svg)`)
|
||
|
}
|
||
|
|
||
|
resetCursor() {
|
||
|
this.setCursor('default')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default new Cursor()
|