Skip to content

Commit

Permalink
feat(animations) : pop animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mutesa-Cedric committed Sep 26, 2023
1 parent 29f2061 commit dcff6c9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/animations/simple/Pop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import wrapper from "@/HOC/wrapper";
import { animation, defaults } from "@/lib/defaultConfigs";

const rule = `
from {
transform: scale(1);
}
50% {
transform: scale(1.1);
}
to {
transform: scale(1);
}
`;


let name: string | undefined;

function make() {
return name || (name = animation(rule));
};

export default function Pop(
{
children,
_out,
timeout,
duration = defaults.duration,
delay = defaults.delay,
count = defaults.count,
forever, ...props
} = defaults
) {
const effect = { make, duration: timeout === undefined ? duration : timeout, delay, forever, count, style: { animationFillMode: 'both', } };
// @ts-expect-error(some props are not allowed, this will be fixed later)
return wrapper(props, effect, false, children, true);
};
1 change: 1 addition & 0 deletions src/animations/simple/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from "./Tada";
export * from "./Swing";
export * from "./Spin";
export * from "./Wobble";
export * from "./Pop";

0 comments on commit dcff6c9

Please sign in to comment.