@@ -9,7 +9,7 @@ magic](https://tim-harding.github.io/squircle/).
9
9
10
10
### CSS
11
11
12
- First, register the squircle web worker.
12
+ First, register the squircle web worker.
13
13
14
14
``` js
15
15
import { register } from " superellipse-squircle" ;
@@ -19,15 +19,16 @@ register();
19
19
Now you can use ` paint(squircle) ` as a image source in CSS. Usually that will be
20
20
` background: paint(squircle); ` , in which case you can use the provided
21
21
` squircle ` class. This includes a fallback to normal rounded rectangles when CSS
22
- Houdini isn't available.
22
+ Houdini isn't available.
23
23
24
24
``` html
25
25
<div
26
26
class =" squircle"
27
27
style ="
28
28
--squircle-border-radius : 1rem ;
29
29
--squircle-background-color : black ; "
30
- ></div >;
30
+ ></div >
31
+ ;
31
32
```
32
33
33
34
These properties control the squircle drawing:
@@ -59,19 +60,19 @@ squircles on all platforms, you can use the web component instead. It will add
59
60
an HTML5 ` <canvas> ` to draw with when the Paint API isn't available.
60
61
61
62
``` js
62
- import { createCustomElement } from ' superellipse-squircle' ;
63
+ import { createCustomElement } from " superellipse-squircle" ;
63
64
createCustomElement ();
64
65
```
65
66
66
67
``` html
67
- <th -squircle
68
+ <ce -squircle
68
69
background-color =" rgba(64, 128, 192, 0.5)"
69
70
border-radius =" 16"
70
71
border-width =" 4"
71
72
border-color =" black"
72
73
>
73
74
Hello, world!
74
- </th -squircle >
75
+ </ce -squircle >
75
76
```
76
77
77
78
### Canvas
@@ -86,13 +87,22 @@ import { draw, paint } from "superellipse-squircle";
86
87
draw (canvasContext, posX, posY, width, height, borderRadius);
87
88
88
89
// Draw the squircle with stroke and fill
89
- paint (canvasContext, posX, posY, width, height, borderRadius,
90
- borderWidth, fillColor, borderColor);
90
+ paint (
91
+ canvasContext,
92
+ posX,
93
+ posY,
94
+ width,
95
+ height,
96
+ borderRadius,
97
+ borderWidth,
98
+ fillColor,
99
+ borderColor,
100
+ );
91
101
```
92
102
93
103
### SVG
94
104
95
- You can create a string that is compatible with SVG ` path ` elements.
105
+ You can create a string that is compatible with SVG ` path ` elements.
96
106
97
107
``` svg
98
108
<svg viewBox =" 0 0 512 512" >
@@ -104,6 +114,6 @@ You can create a string that is compatible with SVG `path` elements.
104
114
import { path } from " superellipse-squircle" ;
105
115
106
116
const d = path (0 , 0 , 512 , 512 , myRadius);
107
- const path = document .getElementById (' my-path' );
117
+ const path = document .getElementById (" my-path" );
108
118
path .d = d;
109
119
```
0 commit comments