(
props: string | string[] = ['all'],
options?: CreateTransitionOptions
)
| 9 | const formatMs = (milliseconds: number) => `${Math.round(milliseconds)}ms`; |
| 10 | |
| 11 | export default function createTransition( |
| 12 | props: string | string[] = ['all'], |
| 13 | options?: CreateTransitionOptions |
| 14 | ): string { |
| 15 | const { duration = 300, easing = defaultEasing.easeInOut, delay = 0 } = options || {}; |
| 16 | |
| 17 | const properties = Array.isArray(props) ? props : [props]; |
| 18 | |
| 19 | return properties |
| 20 | .map((animatedProp) => { |
| 21 | const formattedDuration = typeof duration === 'string' ? duration : formatMs(duration); |
| 22 | const formattedDelay = typeof delay === 'string' ? delay : formatMs(delay); |
| 23 | return `${animatedProp} ${formattedDuration} ${easing} ${formattedDelay}`; |
| 24 | }) |
| 25 | .join(','); |
| 26 | } |
no test coverage detected
searching dependent graphs…