Skip to content

Commit

Permalink
chore: adjust animation to css (#468)
Browse files Browse the repository at this point in the history
Co-authored-by: RayJason <[email protected]>
  • Loading branch information
uyarn and RayJason authored Apr 7, 2024
1 parent 6540dd7 commit 39e2f47
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 62 deletions.
62 changes: 0 additions & 62 deletions packages/components/src/components/td-theme-tabs/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -54,66 +54,4 @@
color: #fff;
}
}
}

:root::view-transition-group(root) {
animation-duration: 1s;
}

:root::view-transition-new(root),
:root::view-transition-old(root) {
mix-blend-mode: normal;
}

:root::view-transition-old(root),
:root[theme-mode='dark']::view-transition-old(root) {
animation: none;
}

:root::view-transition-new(root) {
animation-name: dark-to-light;
}

:root[theme-mode='dark']::view-transition-new(root) {
animation-name: light-to-dark;
}

@keyframes light-to-dark {
from {
clip-path: polygon(
0 0,
0 0,
calc(tan(8deg) * -100vh) 100%,
calc(tan(8deg) * -100vh) 100%
);
}

to {
clip-path: polygon(
0 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
calc(tan(8deg) * -100vh) 100%
);
}
}

@keyframes dark-to-light {
from {
clip-path: polygon(
calc((tan(8deg) * 100vh) + 100%) 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
100% 100%
);
}

to {
clip-path: polygon(
0 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
calc(tan(8deg) * -100vh) 100%
);
}
}
54 changes: 54 additions & 0 deletions packages/components/src/styles/animation.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// light-dark-8deg-animation
@keyframes light-to-dark {
from {
clip-path: polygon(0 0,
0 0,
calc(tan(8deg) * -100vh) 100%,
calc(tan(8deg) * -100vh) 100%);
}

to {
clip-path: polygon(0 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
calc(tan(8deg) * -100vh) 100%);
}
}

@keyframes dark-to-light {
from {
clip-path: polygon(calc((tan(8deg) * 100vh) + 100%) 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
100% 100%);
}

to {
clip-path: polygon(0 0,
calc((tan(8deg) * 100vh) + 100%) 0,
100% 100%,
calc(tan(8deg) * -100vh) 100%);
}
}

:root::view-transition-group(root) {
animation-duration: 1s;
}

:root::view-transition-new(root),
:root::view-transition-old(root) {
mix-blend-mode: normal;
}

:root::view-transition-old(root),
:root[theme-mode='dark']::view-transition-old(root) {
animation: none;
}

:root::view-transition-new(root) {
animation-name: dark-to-light;
}

:root[theme-mode='dark']::view-transition-new(root) {
animation-name: light-to-dark;
}
1 change: 1 addition & 0 deletions packages/components/src/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
@import "./nprogress.less";
@import "./docs.less";
@import "./timeline.less";
@import "./animation.less";

0 comments on commit 39e2f47

Please sign in to comment.