Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit e6ed039

Browse files
committed
refactor(animation): add will-change to make transform fast
1 parent f690d8b commit e6ed039

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/containers/layout/GlobalLayout/styles/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ export const Wrapper = styled.div`
1111
1212
&:before {
1313
content: '';
14-
position: absolute;
14+
position: fixed;
15+
width: 100%;
16+
height: 100%;
1517
left: 0;
1618
top: 0;
1719
background-image: url(${ASSETS_ENDPOINT}/space-background.svg);
18-
background-attachment: fixed;
19-
width: 100%;
20-
height: 100%;
20+
/* background-attachment: fixed; */
21+
/* see https://www.zhangxinxu.com/wordpress/2015/11/css3-will-change-improve-paint/ */
22+
will-change: transform;
2123
opacity: 0.6;
2224
}
2325
`

src/containers/tool/Drawer/styles/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const DrawerWrapper = styled.div.attrs(
5454
color: ${theme('drawer.font')};
5555
box-sizing: border-box;
5656
transition: transform 450ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
57+
will-change: transform;
5758
font-family: Roboto, sans-serif;
5859
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
5960
border-radius: 0px;

0 commit comments

Comments
 (0)