Animation | RevealTransition
RevealTransition#
Description#
- The appearance and dismissal of what is shown or hidden: a section change, a search result, a veil, or a panel coming out of its trigger.
- It is a Vue
<Transition>with theAppletPopovercriteria, so applications stop building their own. What changes is the opacity: it enters in 200 ms withease-ui-outand leaves in 150 ms withease-in. The exit is shorter on purpose: what is leaving should not make what is coming wait.
Props#
scale(boolean) — Besides the opacity, it grows from 0.96 to 1 on enter and shrinks to 0.98 on leave (the «pop» from the trigger).from('left' | 'right' | 'up' | 'down') — It enters displaced 6 px from that side. On leave it does not move: leaving towards the panel reads as «it was saved», and the scale is enough.mode('out-in' | 'in-out') —out-infor what is replaced in the same place: the old one leaves and only then the new one enters.appear(boolean) — Runs the transition on the first mount too.onEnter/onLeave((el: Element, done: () => void) => void) — JavaScript enter and leave hooks. If they receivedone, it has to be called.
Emits#
beforeEnter,afterEnter,enterCancelled,beforeLeave,afterLeave,leaveCancelled— The<Transition>hooks, with the element as payload.
Slot#
- The default one: the content that appears and leaves.
Usage#
| |
Notes#
- For
scaleto grow from the button, whoever uses the component setstransform-originon the element: the transition does not know where its trigger is. - With
prefers-reduced-motiononly the opacity remains. CSS resolves it while drawing (motion-reduce:), becausematchMediadoes not report changes in the WebView and the rule applies anyway. - Only
opacity,scaleandtranslatemove, which compose without redoing the layout. - The durations are the
duration-150andduration-200classes, not a token: the design guard only accepts 100/150/200/300. enterandleavecome as theonEnterandonLeaveprops, not as events:<Transition>counts how many parameters the function declares to know whether it will calldone, and a two-parameter forward would leave it waiting forever.- For the slide between two sections that share the same place, use
SlideTransition.