repel
Objects near the pointer are pushed away from it and spring back when it leaves.
Add the script once, then use the tags anywhere.
<script type="module" src="https://mmaxence.github.io/solids/solids.js"></script>
Or copy the library into your project: download solids.js from the repo and serve it yourself. No build step, no other files.
Usage
Set interaction="repel" on the scene. Interactions are scene rules: they work on every object inside, whatever its type. Several run in the order written.
Options
| Attribute | Type | Default | Range | Description |
|---|---|---|---|---|
repel-radius | number | 140 | 20 to 400 | Reach around the pointer (px) |
repel-strength | number | 0.6 | 0 to 1 | Push strength |
License
MIT. Use it anywhere, credit appreciated.