Passage Transitions¶
Malachite has built in support for transitioning between passages. By default, passages inside a frame will fade in and out. Transitions are further customizable using CSS.
WIP
There's actually no default CSS that comes with Malachite yet, so passages do not fade in and out by default, yet. It will in the near future.
Anatomy Of A Transition¶
When an element starts the transition (i.e. a frame, or when using x-fade or x-reveal), duration of the transition is determined by the CSS transition-duration property of the element. This property gets checked again at the peak of the transition.
During a transition, the following things happen:
- Apply the
.fadestartclass - Emit the
fadestartevent. - Wait for
transition-durationto pass by - Remove the
.fadestartclass and apply the.fadeendclass - Emit the
fadeevent. - Wait for
transition-durationto pass by - Remove the
.fadeendclass - Emit the
fadeendevent.
The transition-duration is checked at step 3. and 6. Which means by applying styles to .fadestart and .fadeend, you can alter the transition behavior.
The fadestart, fade and fadeend events do not bubble.
Example CSS Styling¶
This will create a fade transition for every div element. Replace div with the selector you need.
div {
transition: opacity 0.3s;
}
div.fadestart {
opacity: 0;
transition-timing-function: ease-in;
}
div.fadeend {
transition-timing-function: ease-out;
}
ease-in timing, then fading back in using ease-out.
This is the same default fade effect that is included with Malachite.