Skip to content

🎥 Make videos programmatically with React

upgrade skia

Jonny Burgerb758a6f96066
diff --git a/packages/docs/package.json b/packages/docs/package.json
index dd820ab95e..f532215a75 100644
--- a/packages/docs/package.json
+++ b/packages/docs/package.json
@@ -55,7 +55,7 @@
"@remotion/three": "workspace:*",
"@remotion/transitions": "workspace:*",
"@rive-app/canvas-advanced": "2.3.0",
- "@shopify/react-native-skia": "^0.1.191",
+ "@shopify/react-native-skia": "^1.2.2",
"@swc/core": "^1.3.80",
"@types/uuid": "^8.3.4",
"chalk": "4.1.2",
diff --git a/packages/example/src/Skia/Shader.tsx b/packages/example/src/Skia/Shader.tsx
index 8606e485d9..1688da4081 100644
--- a/packages/example/src/Skia/Shader.tsx
+++ b/packages/example/src/Skia/Shader.tsx
@@ -1,27 +1,41 @@
import {
Canvas,
- Circle,
- Group,
- RuntimeShader,
+ Fill,
+ ImageShader,
+ Shader,
Skia,
+ useImage,
} from '@shopify/react-native-skia';
+import React from 'react';
+import {staticFile} from 'remotion';
const source = Skia.RuntimeEffect.Make(`
uniform shader image;
- 
-half4 main(float2 xy) {
+
+half4 main(float2 xy) {
+ xy.x += sin(xy.y / 3) * 4;
return image.eval(xy).rbga;
-}
-`)!;
+}`)!;
export const RuntimeShaderDemo = () => {
- const r = 128;
+ const s = React.useState(0);
+
+ const image = useImage(staticFile('nested/mp4.png'));
+ if (!image) {
+ return null;
+ }
+
return (
- <Canvas style={{flex: 1}}>
- <Group>
- <RuntimeShader source={source} />
- <Circle cx={r} cy={r} r={r} color="lightblue" />
- </Group>
+ <Canvas style={{width: 1080, height: 1080}}>
+ <Fill>
+ <Shader source={source}>
+ <ImageShader
+ image={image}
+ fit="cover"
+ rect={{x: 0, y: 0, width: 1080, height: 1080}}
+ />
+ </Shader>
+ </Fill>
</Canvas>
);
};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 139c571965..a6648aa41e 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -678,8 +678,8 @@ importers:
specifier: 2.3.0
version: 2.3.0
'@shopify/react-native-skia':
- specifier: ^0.1.191
- version: 0.1.191([email protected])
+ specifier: ^1.2.2
+ version: 1.2.2([email protected])
'@swc/core':
specifier: ^1.3.80
version: 1.3.80
@@ -8773,25 +8773,6 @@ packages:
rollup: 2.76.0
dev: true
- resolution: {integrity: sha512-Tt7W4DEs5n1TTp/cpJXa03VdXHnK5CnEtdwFzi6gd1I8qjbVVXz3MUmqi5ZIwfXHF0wZ8+0H67tfe8N2H6xWYg==}
- hasBin: true
- requiresBuild: true
- peerDependencies:
- react: '>=18.0'
- react-native: '>=0.64'
- react-native-reanimated: '>=2.0.0'
- peerDependenciesMeta:
- react-native:
- optional: true
- react-native-reanimated:
- optional: true
- dependencies:
- canvaskit-wasm: 0.38.0
- react: 18.2.0
- react-reconciler: 0.27.0([email protected])
- dev: false
-
resolution: {integrity: sha512-YlDNJXTCstlOmyJxeQjaTaef8ACLuEPMDrSgEichQM3ELlWuU1HTSVbpXW2x4LbbEDPXwu/aF/16MUN8pzzcmA==}
hasBin: true
@@ -11439,10 +11420,6 @@ packages:
postcss-value-parser: 4.2.0
dev: false
- resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==}
- engines: {node: '>= 0.4'}
-
resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==}
engines: {node: '>= 0.4'}
@@ -11972,10 +11949,6 @@ packages:
resolution: {integrity: sha512-rs2ZygrG1PNXMfmncM0B5H1hndY5ZCC9b5TkFaVNfZ+AUlyqcMyVIQtc3fsezi0NUCk5XZfDf9WS6WxMxnfdrg==}
- resolution: {integrity: sha512-ZEG6lucpbQ4Ld+mY8C1Ng+PMLVP+/AX02jS0Sdl28NyMxuKSa9uKB8oGd1BYp1XWPyO2Jgr7U8pdyjJ/F3xR5Q==}
- dev: false
-
resolution: {integrity: sha512-Gy3lCmhUdKq+8bvDrs9t8+qf7RvcjuQn+we7vTVVyqgOVO1UVfHpsnBxkTZw+R4ApEJ3D5fKySl9TU11hmjl/A==}
dependencies:
@@ -15151,12 +15124,6 @@ packages:
resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==}
- engines: {node: '>= 0.4'}
- dependencies:
- has-symbols: 1.0.3
-
resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==}
engines: {node: '>= 0.4'}
@@ -15409,7 +15376,7 @@ packages:
dependencies:
inherits: 2.0.4
obuf: 1.1.2
- readable-stream: 2.3.7
+ readable-stream: 2.3.8
wbuf: 1.7.3
dev: false
@@ -15725,7 +15692,7 @@ packages:
dependencies:
es-errors: 1.3.0
hasown: 2.0.2
- side-channel: 1.0.4
+ side-channel: 1.0.6
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
@@ -15789,7 +15756,7 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.7
- has-tostringtag: 1.0.0
+ has-tostringtag: 1.0.2
dev: false
@@ -15956,7 +15923,7 @@ packages:
resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==}
engines: {node: '>= 0.4'}
dependencies:
- has-tostringtag: 1.0.0
+ has-tostringtag: 1.0.2
resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==}
@@ -16116,16 +16083,6 @@ packages:
dependencies:
has-symbols: 1.0.3
- resolution: {integrity: sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==}
- engines: {node: '>= 0.4'}
- dependencies:
- available-typed-arrays: 1.0.5
- call-bind: 1.0.7
- for-each: 0.3.3
- gopd: 1.0.1
- has-tostringtag: 1.0.0
-
resolution: {integrity: sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw==}
engines: {node: '>= 0.4'}
@@ -17993,9 +17950,6 @@ packages:
engines: {node: '>= 6'}
dev: false
- resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==}
-
resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==}
@@ -19613,10 +19567,6 @@ packages:
resolution: {integrity: sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==}
dev: false
- resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
- engines: {node: '>=6'}
-
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@@ -20029,8 +19979,8 @@ packages:
type-fest: 0.6.0
dev: false
- resolution: {integrity: sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==}
+ resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
dependencies:
core-util-is: 1.0.3
inherits: 2.0.4
@@ -20990,13 +20940,6 @@ packages:
vscode-textmate: 8.0.0
dev: true
- resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
- dependencies:
- call-bind: 1.0.7
- get-intrinsic: 1.2.4
- object-inspect: 1.12.2
-
resolution: {integrity: sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==}
engines: {node: '>= 0.4'}
@@ -22651,7 +22594,7 @@ packages:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
dependencies:
- punycode: 2.1.1
+ punycode: 2.3.1
resolution: {integrity: sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==}
@@ -22762,8 +22705,8 @@ packages:
inherits: 2.0.4
is-arguments: 1.1.1
is-generator-function: 1.0.10
- is-typed-array: 1.1.10
- which-typed-array: 1.1.9
+ is-typed-array: 1.1.13
+ which-typed-array: 1.1.15
dev: false
@@ -23674,7 +23617,7 @@ packages:
isarray: 2.0.5
which-boxed-primitive: 1.0.2
which-collection: 1.0.2
- which-typed-array: 1.1.9
+ which-typed-array: 1.1.15
resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==}
@@ -23708,17 +23651,6 @@ packages:
gopd: 1.0.1
has-tostringtag: 1.0.2
- resolution: {integrity: sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==}
- engines: {node: '>= 0.4'}
- dependencies:
- available-typed-arrays: 1.0.5
- call-bind: 1.0.7
- for-each: 0.3.3
- gopd: 1.0.1
- has-tostringtag: 1.0.0
- is-typed-array: 1.1.10
-
resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==}
hasBin: true