View Transition for Flarum
Bringing a bit more smoothness when you hanging out the forum.
Feature
Providing transition while page switching, make the sudden away (some of them).
The animation is fade in and out by default. Please click the image to watch video:
[Remove until we find a new storage]
It's enough for the most case. However, you can go further to make perfect.
Such as...create some Google feel:
[Remove until we find a new storage]
How easy it is? Just as easy as putting this code below into custom CSS/Less!
@keyframes fade-in {
from { opacity: 0; }
}
@keyframes fade-out {
to { opacity: 0; }
}
@keyframes slide-from-right {
from { transform: translateX(30px); }
}
@keyframes slide-to-left {
to { transform: translateX(-30px); }
}
::view-transition-old(root) {
animation: 90ms cubic-bezier(0.4, 0, 1, 1) both fade-out,
300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left;
}
::view-transition-new(root) {
animation: 210ms cubic-bezier(0, 0, 0.2, 1) 90ms both fade-in,
300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
}
#alerts {
view-transition-name: alerts;
}
.App-composer {
view-transition-name: composer;
}
aside.DiscussionPage-list {
view-transition-name: discussionlist;
}
#header {
view-transition-name: header;
}
(Modified from the code provided by Chrome for Developers,original code sample is licensed under the Apache 2.0 license)
Want to make something different your own? Go to MDN to learn more.
Install
composer require dalez/flarum-view-transition:"*"
(It is not currently marked as an stable version and may require additional parameters to be specified)
Links
Note
- View Transition is a new feature for browsers, with low compatibility. Go to Caniuse to learn if it's compatible with your browser.
- This extension is seperated from Fluent which is currently developing (see DaleZ). Fluent will have its own transition, with specially tailored animation.
- Any contribution to it is welcome. I'm especially looking forward to the more perfect Google and Apple's animation. 😋