-
Notifications
You must be signed in to change notification settings - Fork 775
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1026 from framer/fix/canvas-memory-usage
Reducing canvas memory usage
- Loading branch information
Showing
88 changed files
with
1,734 additions
and
1,072 deletions.
There are no files selected for viewing
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
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,42 +1,46 @@ | ||
import * as React from "react" | ||
import { motion, motionValue } from "@framer" | ||
import { motion, motionValue, MotionConfig } from "@framer" | ||
|
||
/** | ||
* An example of providing a MotionValue to an SVG component via its props | ||
*/ | ||
|
||
export const App = () => { | ||
const params = new URLSearchParams(window.location.search) | ||
const isStatic = Boolean(params.get("isStatic")) | ||
return ( | ||
<svg | ||
width="1000" | ||
height="1000" | ||
viewBox="0 0 1000 1000" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={motionValue(50)} | ||
y={50} | ||
data-testid="rotate" | ||
style={{ rotate: 45 }} | ||
/> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={50} | ||
y={200} | ||
data-testid="scale" | ||
style={{ scale: 2 }} | ||
/> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={50} | ||
y={350} | ||
data-testid="translate" | ||
style={{ x: 100 }} | ||
/> | ||
</svg> | ||
<MotionConfig isStatic={isStatic}> | ||
<svg | ||
width="1000" | ||
height="1000" | ||
viewBox="0 0 1000 1000" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={motionValue(50)} | ||
y={50} | ||
data-testid="rotate" | ||
style={{ rotate: 45 }} | ||
/> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={50} | ||
y={200} | ||
data-testid="scale" | ||
style={{ scale: 2 }} | ||
/> | ||
<motion.rect | ||
height="100" | ||
width="100" | ||
x={50} | ||
y={350} | ||
data-testid="translate" | ||
style={{ x: 100 }} | ||
/> | ||
</svg> | ||
</MotionConfig> | ||
) | ||
} |
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
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
Oops, something went wrong.