-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1a5fe4e
commit 8c1c9ed
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ import RevealBase from '../lib/Base.js' | |
* @param {React.ReactNode} children | ||
* @returns {React.ReactNode} | ||
Check warning on line 14 in src/HOC/wrapper.tsx GitHub Actions / lint
|
||
*/ | ||
export default function wrapper(props: { when: any; in: any }, inEffect: any, outEffect: any, children: string | number | boolean | | ||
export default function wrapper(props: { when: any; in: any, }, inEffect: any, outEffect: any, children: string | number | boolean | | ||
React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined) { | ||
if ('in' in props) | ||
props.when = props.in | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import wrapper from '@/HOC/wrapper'; | ||
import { animation, defaults } from '@/lib/defaultConfigs'; | ||
|
||
|
||
const rule = ` | ||
from, 20%, 53%, 80%, to { | ||
animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000); | ||
transform: translate3d(0,0,0); | ||
} | ||
40%, 43% { | ||
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); | ||
transform: translate3d(0, -30px, 0); | ||
} | ||
70% { | ||
animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060); | ||
transform: translate3d(0, -15px, 0); | ||
} | ||
90% { | ||
transform: translate3d(0, -4px, 0); | ||
} | ||
`; | ||
|
||
let name: string | undefined; | ||
function make() { | ||
return name || (name = animation(rule)); | ||
} | ||
|
||
|
||
function Jump({ 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); | ||
} | ||
|
||
export default Jump; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters