You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,8 +21,17 @@ npm install
21
21
```js
22
22
importSvgRendererfrom'scratch-svg-renderer';
23
23
24
-
var svgRenderer =newSvgRenderer();
25
-
svgRenderer.fromString(svgData, callback);
24
+
constsvgRenderer=newSvgRenderer();
25
+
26
+
constsvgData="<svg>...</svg>";
27
+
constscale=1;
28
+
constquirksMode=false; // If true, emulate Scratch 2.0 SVG rendering "quirks"
29
+
functiondoSomethingWith(canvas) {...};
30
+
31
+
svgRenderer.loadSVG(svgData, quirksMode, () => {
32
+
svgRenderer.draw(scale);
33
+
doSomethingWith(svgRenderer.canvas);
34
+
});
26
35
```
27
36
28
37
## How to run locally as part of scratch-gui
@@ -49,4 +58,4 @@ To run scratch-svg-renderer locally as part of scratch-gui, for development:
49
58
6. In scratch-gui, follow its instructions to run it or build its code
50
59
51
60
## Donate
52
-
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
61
+
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
0 commit comments