modern-canvas 0.1.10 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -26
- package/dist/index.cjs +10400 -9568
- package/dist/index.d.cts +1399 -1353
- package/dist/index.d.mts +1399 -1353
- package/dist/index.d.ts +1399 -1353
- package/dist/index.js +123 -104
- package/dist/index.mjs +10394 -9559
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ npm i modern-canvas
|
|
|
27
27
|
## 🦄 Usage
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
import {
|
|
30
|
+
import { Animation, Engine, Image2D, Text2D } from 'modern-canvas'
|
|
31
31
|
import { fonts } from 'modern-font'
|
|
32
32
|
|
|
33
33
|
async function loadFallbackFont() {
|
|
@@ -50,25 +50,22 @@ loadFallbackFont().then(() => {
|
|
|
50
50
|
filter: 'brightness(102%) contrast(90%) saturate(128%) sepia(18%)',
|
|
51
51
|
},
|
|
52
52
|
src: '/example.png',
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
],
|
|
70
|
-
}),
|
|
71
|
-
)
|
|
53
|
+
}, [
|
|
54
|
+
new Animation({
|
|
55
|
+
duration: 3000,
|
|
56
|
+
loop: true,
|
|
57
|
+
keyframes: [
|
|
58
|
+
{ offset: 1, rotate: 180 },
|
|
59
|
+
],
|
|
60
|
+
}),
|
|
61
|
+
new Text2D({
|
|
62
|
+
fonts,
|
|
63
|
+
style: {
|
|
64
|
+
fontSize: 30,
|
|
65
|
+
},
|
|
66
|
+
content: '/example.png',
|
|
67
|
+
}),
|
|
68
|
+
])
|
|
72
69
|
)
|
|
73
70
|
|
|
74
71
|
console.log(engine)
|
|
@@ -77,9 +74,9 @@ loadFallbackFont().then(() => {
|
|
|
77
74
|
})
|
|
78
75
|
```
|
|
79
76
|
|
|
80
|
-
##
|
|
77
|
+
## Effects
|
|
81
78
|
|
|
82
|
-
See the [
|
|
79
|
+
See the [scene/effects](./src/scene/effects)
|
|
83
80
|
|
|
84
81
|
```typescript
|
|
85
82
|
import { EmbossEffect, Image2D } from 'modern-canvas'
|
|
@@ -87,9 +84,8 @@ import { EmbossEffect, Image2D } from 'modern-canvas'
|
|
|
87
84
|
engine.root.addChild(
|
|
88
85
|
new Image2D({
|
|
89
86
|
src: '/example.png',
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
87
|
+
}, [
|
|
88
|
+
new EmbossEffect(),
|
|
89
|
+
])
|
|
94
90
|
)
|
|
95
91
|
```
|