Get started
This page shows how to add the default effects to a page with a bundler. For a page without a bundler, read Use a script tag.
Requirements
- A bundler that reads ES modules, for example Vite.
- A browser from the list of supported browsers.
Procedure
Add the package to your project:
shpnpm add magic-cursor-wandImport
createWandand call it one time when the page starts:tsimport { createWand } from 'magic-cursor-wand'; const wand = createWand();Move the pointer on the page. Make sure that the cloud and glitter effects follow the pointer.
Push the primary button and move the pointer. Make sure that the chalk effect draws a line.
To change a value, call
setConfig:tswand.setConfig({ chalk: { size: 20 } });To remove the canvas and all listeners, call
destroy:tswand.destroy();
Result
The wand shows the cloud, chalk and glitter effects in a fixed canvas above the page. The canvas does not stop clicks.
Supported browsers
| Browser | Minimum version |
|---|---|
| Chrome and Edge | 88 |
| Firefox | 85 |
| Safari and Safari on iOS | 14.5 |
Next steps
- Read about the surface and the configuration.
- Keep the settings in the browser.
- Open the settings panel.