-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
Allow fallback animations on html element |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ export function renderTransition( | |
} | ||
} | ||
} else if (animationName === 'none') { | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I might be wrong but I from my testing the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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 commentThe reason will be displayed to describe this comment to others. Learn more. Changeed it with this: 00dd8ee |
||
sheet.addAnimationRaw('new', 'animation: none; mix-blend-mode: normal;'); | ||
} | ||
|
||
|
@@ -92,7 +92,9 @@ class ViewTransitionStyleSheet { | |
this.addRule('modern', `::view-transition-${image}(${name}) { ${animation} }`); | ||
this.addRule( | ||
'fallback', | ||
`[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"] { ${animation} }` | ||
// Two selectors here, the second in case there is an animation on the root. | ||
`[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"], | ||
[data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }` | ||
); | ||
} | ||
|
||
|
@@ -107,7 +109,8 @@ class ViewTransitionStyleSheet { | |
this.addRule('modern', `${prefix}::view-transition-${image}(${name}) { ${animation} }`); | ||
this.addRule( | ||
'fallback', | ||
`${prefix}[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"] { ${animation} }` | ||
`${prefix}[data-astro-transition-fallback="${image}"] [data-astro-transition-scope="${scope}"], | ||
${prefix}[data-astro-transition-fallback="${image}"][data-astro-transition-scope="${scope}"] { ${animation} }` | ||
); | ||
} | ||
} | ||
|
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! This is the API I was talking about. Support matrix looks good to me.