-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow fallback animations on html element #8258
Conversation
🦋 Changeset detectedLatest commit: 00dd8ee The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
// Trigger the animations | ||
document.documentElement.dataset.astroTransitionFallback = 'old'; | ||
const finished = Promise.all(document.getAnimations().map(a => a.finished)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sheet.addAnimationRaw('old', 'animation: none; opacity: 0; mix-blend-mode: normal;'); | ||
sheet.addAnimationRaw('old', 'animation: none; mix-blend-mode: normal;'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I might be wrong but I from my testing the opacity: 0
was needed because of stacking when using view transitions (not the fallback). This should be handled by mix-blend-mode: normal
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i wanted to get your opinion on this. I thought it was for that reason. Isn't the reason to do this so you can see the new element which is behind it? But for none
is that necessary as both elements are the same?
I removed this because it makes it so that in fallback mode the element is invisible until both animations are complete. We might need a mechanism for VT only styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changeed it with this: 00dd8ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks great!
Changes
html
element by fixing the selector so it targets both children and the root itself.animationstart
did not fire before the setTimeout.finished
event.opacity: 0
for thenone
animation as that causes the element to be invisible.Testing
Safari.mp4
Docs
N/A