-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[update] Replace SVG rendering with Canvas
This is not an arbitrary change, however further study into using Canvas over SVG has made me discover a few things: - This is a performance critical component. Using Canvas bypasses the React rendering pipeline. This means that <Ink /> will not choke up the React update process. - The memory usage is staggeringly slower than SVG - React doesn't have fantastic support for SVG filters. With canvas we can begin to explore composite operations and other fun effects.
- Loading branch information
Showing
8 changed files
with
111 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
module.exports = { | ||
borderRadius: "inherit", | ||
color: "inherit", | ||
height: "100%", | ||
left: 0, | ||
position: "absolute", | ||
top: 0, | ||
width: "100%", | ||
willChange: 'transform, opacity' | ||
width: "100%" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Good stuff here: | ||
// http://www.html5rocks.com/en/tutorials/canvas/hidpi/ | ||
|
||
export default context => { | ||
let devicePixelRatio = window.devicePixelRatio || 1 | ||
let backingStoreRatio = context.webkitBackingStorePixelRatio || | ||
context.mozBackingStorePixelRatio || | ||
context.msBackingStorePixelRatio || | ||
context.oBackingStorePixelRatio || | ||
context.backingStorePixelRatio || 1 | ||
|
||
return devicePixelRatio / backingStoreRatio | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters