Installation
Install the component
Run the following command to install the component and its dependencies:
npx @motion-core/cli add magneticImport the component
Import the component into your Svelte file:
Pointer
A wrapper that applies spring physics to elements, making them stick to the cursor on hover.
npx @motion-core/cli add magneticimport { Magnetic } from "$lib/motion-core";import { Magnetic } from "$lib/motion-core";<script lang="ts">
import { Magnetic } from "motion-core";
</script>
<Magnetic>
<button
class="card h-8 gap-1.5 rounded-sm bg-background-muted px-3 text-xs font-medium tracking-wide text-foreground uppercase"
>
Magnetic Button
</button>
</Magnetic>
| Prop | Type | Default |
|---|---|---|
duration | number | 1 |
ease | string | "elastic.out(1, 0.3)" |
class | string | — |