Skip to content

Commit 2045165

Browse files
authored
Merge pull request #3823 from leomarquine/fade-easing
Add easing param to fade transition
2 parents 33ebcfb + 46e9e94 commit 2045165

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/runtime/transition/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cubicOut, cubicInOut } from 'svelte/easing';
1+
import { cubicOut, cubicInOut, linear } from 'svelte/easing';
22
import { assign, is_function } from 'svelte/internal';
33

44
type EasingFunction = (t: number) => number;
@@ -43,17 +43,20 @@ export function blur(node: Element, {
4343
interface FadeParams {
4444
delay: number;
4545
duration: number;
46+
easing: EasingFunction;
4647
}
4748

4849
export function fade(node: Element, {
4950
delay = 0,
50-
duration = 400
51+
duration = 400,
52+
easing = linear
5153
}: FadeParams): TransitionConfig {
5254
const o = +getComputedStyle(node).opacity;
5355

5456
return {
5557
delay,
5658
duration,
59+
easing,
5760
css: t => `opacity: ${t * o}`
5861
};
5962
}

0 commit comments

Comments
 (0)