Skip to content

Commit

Permalink
Disable will-change CSS property (#75)
Browse files Browse the repository at this point in the history
* Disable will-change CSS property

* Add story for will-change
  • Loading branch information
nuc authored and oblador committed Nov 9, 2018
1 parent 7d0695f commit b517eaa
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/react/src/AnimatedComponent.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
transform: rotate(360deg);
}

.CSSTransition-will-change {
will-change: transform;
}

.CSSAnimation {
animation: 1.5s AnimatedComponent-spin infinite normal linear;
}
Expand Down
8 changes: 8 additions & 0 deletions examples/react/src/AnimatedComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ export const CSSTransition = withAlternatingState(({ on }) => (
/>
));

export const CSSTransitionWillChange = withAlternatingState(({ on }) => (
<div
className={`AnimatedComponent CSSTransition CSSTransitionWillChange ${
on ? 'CSSTransition-on' : ''
}`}
/>
));

export const CSSAnimation = () => (
<div className="AnimatedComponent CSSAnimation" />
);
Expand Down
3 changes: 3 additions & 0 deletions examples/react/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ storiesOf('Asynchronous render', module)

storiesOf('Animation', module)
.add('with CSS transition', () => <AnimatedComponent.CSSTransition />)
.add('with CSS transition with will-change property', () => (
<AnimatedComponent.CSSTransitionWillChange />
))
.add('with CSS animation', () => <AnimatedComponent.CSSAnimation />)
.add('with react-motion', () => <AnimatedComponent.ReactMotion />);

Expand Down
1 change: 1 addition & 0 deletions src/targets/chrome/disable-animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const disableAnimations = window => {
transition: none !important;
-webkit-animation: none !important;
animation: none !important;
will-change: auto !important;
}
`;

Expand Down

0 comments on commit b517eaa

Please sign in to comment.