modern-canvas 0.2.2 → 0.2.4

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 CHANGED
@@ -18,6 +18,18 @@
18
18
  </a>
19
19
  </p>
20
20
 
21
+ ## Features
22
+
23
+ - WebGL and WebGL2
24
+
25
+ - Animation
26
+
27
+ - Special effects
28
+
29
+ - Transition effects
30
+
31
+ - Describe element as you would a CSSStyle
32
+
21
33
  ## 📦 Install
22
34
 
23
35
  ```shell
@@ -27,7 +39,7 @@ npm i modern-canvas
27
39
  ## 🦄 Usage
28
40
 
29
41
  ```javascript
30
- import { Animation, Engine, Image2D, Text2D } from 'modern-canvas'
42
+ import { Animation, Engine, Image2D, Text2D, Video2D } from 'modern-canvas'
31
43
  import { fonts } from 'modern-font'
32
44
 
33
45
  async function loadFallbackFont() {
@@ -65,6 +77,16 @@ loadFallbackFont().then(() => {
65
77
  },
66
78
  content: '/example.png',
67
79
  }),
80
+ new Video2D({
81
+ style: {
82
+ left: 200,
83
+ top: 200,
84
+ width: 100,
85
+ height: 100,
86
+ maskImage: '/example.png',
87
+ },
88
+ src: '/example.mp4',
89
+ }),
68
90
  ])
69
91
  )
70
92
 
@@ -74,9 +96,9 @@ loadFallbackFont().then(() => {
74
96
  })
75
97
  ```
76
98
 
77
- ## Effects
99
+ ## Special effect
78
100
 
79
- See the [scene/effects](./src/scene/effects)
101
+ See all [preset special effects](./src/scene/effects)
80
102
 
81
103
  ```typescript
82
104
  import { EmbossEffect, Image2D } from 'modern-canvas'
@@ -89,3 +111,38 @@ engine.root.addChild(
89
111
  ])
90
112
  )
91
113
  ```
114
+
115
+ ## Transition effect
116
+
117
+ See all [preset transitions](./src/scene/transitions)
118
+
119
+ ```typescript
120
+ import { Image2D, TiltShiftTransition } from 'modern-canvas'
121
+
122
+ engine.root.addChild(
123
+ new Image2D({
124
+ src: '/example.png',
125
+ }),
126
+ new TiltShiftTransition(),
127
+ new Image2D({
128
+ src: '/example.gif',
129
+ }),
130
+ )
131
+ ```
132
+
133
+ Use https://github.com/gl-transitions/gl-transitions with `vite`
134
+
135
+ ```ts
136
+ import bounceGLSL from 'gl-transitions/transitions/Bounce.glsl?raw'
137
+ import { Image2D, Transition } from 'modern-canvas'
138
+
139
+ engine.root.addChild(
140
+ new Image2D({
141
+ src: '/example.png',
142
+ }),
143
+ new Transition({ glsl: bounceGLSL }),
144
+ new Image2D({
145
+ src: '/example.gif',
146
+ }),
147
+ )
148
+ ```