Animates a blur filter alongside an element’s opacity. Creates a smooth blur effect as the element transitions in or out.
Usage
<script>
import { blur } from 'svelte/transition';
</script>
<div transition:blur>blurs in and out</div>
<div in:blur>blurs in</div>
<div out:blur>blurs out</div>
Parameters
Milliseconds before starting the transition
Duration of the transition in milliseconds
easing
function
default:"cubicInOut"
amount
number | string
default:"5"
The blur amount. Can be a number (pixels) or a CSS length string (e.g., ‘10px’, ‘1rem’)
The target opacity value (between 0 and 1) when the element is fully transitioned out
Example with parameters
<script>
import { blur } from 'svelte/transition';
</script>
<div transition:blur={{ amount: 10, duration: 600 }}>
blurs with stronger effect
</div>
<div transition:blur={{ amount: '2rem', opacity: 0.5 }}>
blurs to semi-transparent
</div>