Skip to content

Commit

Permalink
Merge pull request #3823 from leomarquine/fade-easing
Browse files Browse the repository at this point in the history
Add easing param to fade transition
  • Loading branch information
Rich-Harris authored Nov 6, 2019
2 parents 33ebcfb + 46e9e94 commit 2045165
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/runtime/transition/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cubicOut, cubicInOut } from 'svelte/easing';
import { cubicOut, cubicInOut, linear } from 'svelte/easing';
import { assign, is_function } from 'svelte/internal';

type EasingFunction = (t: number) => number;
Expand Down Expand Up @@ -43,17 +43,20 @@ export function blur(node: Element, {
interface FadeParams {
delay: number;
duration: number;
easing: EasingFunction;
}

export function fade(node: Element, {
delay = 0,
duration = 400
duration = 400,
easing = linear
}: FadeParams): TransitionConfig {
const o = +getComputedStyle(node).opacity;

return {
delay,
duration,
easing,
css: t => `opacity: ${t * o}`
};
}
Expand Down

0 comments on commit 2045165

Please sign in to comment.