@remotion/effects 4.0.535 → 4.0.537

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.
@@ -0,0 +1,30 @@
1
+ declare const IRIS_SHAPES: readonly ["triangle", "square", "pentagon", "hexagon", "heptagon", "octagon", "nonagon", "decagon", "circle"];
2
+ export type LensBlurIrisShape = (typeof IRIS_SHAPES)[number];
3
+ export type LensBlurParams = {
4
+ /** Blur radius in pixels. Defaults to `10`. */
5
+ readonly radius?: number;
6
+ /** Iris shape. Defaults to `hexagon`. */
7
+ readonly irisShape?: LensBlurIrisShape;
8
+ /** Roundness of the iris, from 0 (polygon) to 1 (circle). Defaults to `0`. */
9
+ readonly irisRoundness?: number;
10
+ /** Clockwise iris rotation in degrees. Defaults to `0`. */
11
+ readonly irisRotation?: number;
12
+ /** Horizontal stretch of the iris. Must be greater than zero. Defaults to `1`. */
13
+ readonly irisAspectRatio?: number;
14
+ /** Additional brightness of highlights, from 0 to 1. Defaults to `0`. */
15
+ readonly highlightGain?: number;
16
+ /** Minimum luminance for highlight gain, from 0 to 1. Defaults to `1`. */
17
+ readonly highlightThreshold?: number;
18
+ /** Saturation of added highlight brightness, from 0 to 1. Defaults to `1`. */
19
+ readonly highlightSaturation?: number;
20
+ /** Repeat edge pixels outside the source instead of sampling transparency. Defaults to `false`. */
21
+ readonly repeatEdgePixels?: boolean;
22
+ /** Number of aperture samples, from 16 to 2048. Higher values reduce grain. Defaults to `256`. */
23
+ readonly samples?: number;
24
+ /** Average colors in linear light. Defaults to `false`. */
25
+ readonly linearLight?: boolean;
26
+ };
27
+ export declare const lensBlur: (params?: (LensBlurParams & {
28
+ readonly disabled?: boolean | undefined;
29
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
30
+ export {};
@@ -0,0 +1 @@
1
+ export declare const LENS_BLUR_FRAGMENT_SHADER = "#version 300 es\nprecision highp float;\n\nin vec2 vUv;\nout vec4 fragColor;\n\nuniform sampler2D uSource;\nuniform vec2 uResolution;\nuniform float uRadius;\nuniform int uIrisShape;\nuniform float uIrisRoundness;\nuniform float uIrisRotation;\nuniform float uIrisAspectRatio;\nuniform float uHighlightGain;\nuniform float uHighlightThreshold;\nuniform float uHighlightSaturation;\nuniform bool uRepeatEdgePixels;\nuniform int uSamples;\nuniform bool uLinearLight;\n\nconst float PI = 3.141592653589793;\nconst float GOLDEN_ANGLE = 2.399963229728653;\n\nvec3 toLinear(vec3 color) {\n\treturn mix(color / 12.92, pow((color + 0.055) / 1.055, vec3(2.4)), step(vec3(0.04045), color));\n}\n\nvec3 toSrgb(vec3 color) {\n\treturn mix(color * 12.92, 1.055 * pow(max(color, vec3(0.0)), vec3(1.0 / 2.4)) - 0.055, step(vec3(0.0031308), color));\n}\n\nvec4 readSource(vec2 uv) {\n\tvec4 sampleColor = texture(uSource, uv);\n\tif (sampleColor.a <= 0.0) return vec4(0.0);\n\tvec3 color = sampleColor.rgb / sampleColor.a;\n\tfloat luminance = dot(color, vec3(0.2126, 0.7152, 0.0722));\n\tif (uLinearLight) color = toLinear(color);\n\tif (luminance >= uHighlightThreshold) {\n\t\tfloat brightest = max(color.r, max(color.g, color.b));\n\t\tvec3 highlight = mix(vec3(brightest), color, uHighlightSaturation);\n\t\tcolor += highlight * (4.0 * uHighlightGain);\n\t}\n\n\tfloat coverage = 1.0;\n\tif (!uRepeatEdgePixels) {\n\t\t// The texture clamps to its edge texels. Fade their bilinear footprint\n\t\t// against transparent texels beyond the canvas instead of cutting it off.\n\t\tvec2 pixel = uv * uResolution;\n\t\tvec2 nearEdge = clamp(pixel + 0.5, 0.0, 1.0);\n\t\tvec2 farEdge = clamp(uResolution + 0.5 - pixel, 0.0, 1.0);\n\t\tcoverage = nearEdge.x * nearEdge.y * farEdge.x * farEdge.y;\n\t}\n\treturn vec4(color * sampleColor.a, sampleColor.a) * coverage;\n}\n\nvoid main() {\n\t// A zero radius must be an exact identity, including with highlight gain.\n\tif (uRadius == 0.0) {\n\t\tfragColor = texture(uSource, vUv);\n\t\treturn;\n\t}\n\n\tvec4 sum = vec4(0.0);\n\tfloat totalWeight = 0.0;\n\tfor (int i = 0; i < 2048; i++) {\n\t\tif (i >= uSamples) break;\n\t\tfloat angle = float(i) * GOLDEN_ANGLE;\n\t\tfloat boundary = 1.0;\n\t\tif (uIrisShape < 11) {\n\t\t\tfloat halfSector = PI / float(uIrisShape);\n\t\t\tfloat localAngle = mod(angle + PI / 2.0, 2.0 * halfSector) - halfSector;\n\t\t\tfloat polygon = cos(halfSector) / cos(localAngle);\n\t\t\tboundary = mix(polygon, 1.0, uIrisRoundness);\n\t\t}\n\t\tfloat distance = sqrt((float(i) + 0.5) / float(uSamples)) * boundary;\n\t\tfloat rotatedAngle = angle + uIrisRotation;\n\t\tvec2 offset = vec2(cos(rotatedAngle) * uIrisAspectRatio, -sin(rotatedAngle)) * distance * uRadius;\n\t\t// Radially mapping a disc onto a polygon changes area by boundary^2.\n\t\t// Weight by that Jacobian to keep the aperture uniformly illuminated.\n\t\tfloat weight = boundary * boundary;\n\t\tsum += readSource(vUv - offset / uResolution) * weight;\n\t\ttotalWeight += weight;\n\t}\n\n\tvec4 color = sum / totalWeight;\n\tif (uLinearLight && color.a > 0.0) {\n\t\tcolor.rgb = toSrgb(color.rgb / color.a) * color.a;\n\t}\n\t// Keep the result premultiplied even when highlights exceed display white.\n\tfragColor = vec4(clamp(color.rgb, vec3(0.0), vec3(color.a)), color.a);\n}\n";
@@ -0,0 +1 @@
1
+ export { lensBlur, type LensBlurParams, type LensBlurIrisShape, } from './lens-blur/index.js';
@@ -0,0 +1,20 @@
1
+ export type PageTurnRender = 'both' | 'front' | 'back';
2
+ export type PageTurnParams = {
3
+ /** Position of the fold as fractions of the canvas size. Defaults to [0.7, 0.7]. */
4
+ readonly foldPosition?: readonly [number, number];
5
+ /** Angle of the fold line in degrees. Defaults to 315. */
6
+ readonly foldDirection?: number;
7
+ /** Curl radius in pixels. Must be greater than zero. Defaults to 60. */
8
+ readonly foldRadius?: number;
9
+ /** Direction of the light in degrees. Defaults to -45. */
10
+ readonly lightDirection?: number;
11
+ /** Which faces to show. Defaults to 'both'. */
12
+ readonly render?: PageTurnRender;
13
+ /** Visibility of the source image on the back, from 0 to 1. Defaults to 0.25. */
14
+ readonly backPageOpacity?: number;
15
+ /** Color of the paper back. Defaults to white. */
16
+ readonly paperColor?: string;
17
+ };
18
+ export declare const pageTurn: (params?: (PageTurnParams & {
19
+ readonly disabled?: boolean | undefined;
20
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
@@ -0,0 +1 @@
1
+ export declare const PAGE_TURN_SHADER = "\nstruct Params {\n resolution: vec2f,\n foldPosition: vec2f,\n geometry: vec4f,\n paperColor: vec4f,\n back: vec4f,\n}\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {\n let positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n return vec4f(positions[index], 0, 1);\n}\n\nfn samplePage(pixel: vec2f) -> vec4f {\n if (any(pixel < vec2f(0)) || any(pixel >= params.resolution)) { return vec4f(0); }\n // The shared projection sampler wraps horizontally; pages must not wrap at the edges.\n let uv = clamp(pixel, vec2f(0.5), params.resolution - vec2f(0.5)) / params.resolution;\n return textureSampleLevel(source, sourceSampler, uv, 0);\n}\n\n@fragment fn fragment(@builtin(position) position: vec4f) -> @location(0) vec4f {\n let radius = params.geometry.x;\n let direction = params.geometry.y;\n let normal = vec2f(-sin(direction), cos(direction));\n let distance = dot(position.xy - params.foldPosition, normal);\n let coverage = 1.0 - smoothstep(radius - max(fwidth(distance), 0.001), radius, distance);\n if (distance >= radius) { return vec4f(0); }\n\n var front = vec4f(0);\n var back = vec4f(0);\n var backDistance = 3.14159265359 * radius - distance;\n var backShade = 0.9;\n if (distance <= 0.0) {\n front = samplePage(position.xy);\n } else {\n let angle = asin(clamp(distance / radius, 0.0, 1.0));\n let frontDistance = radius * angle;\n backDistance = 3.14159265359 * radius - frontDistance;\n let light = params.geometry.z;\n let lightDot = normal.x * sin(light) - normal.y * cos(light);\n let shade = 1.0 - 0.4 * (angle / 1.57079632679) * (0.5 + 0.5 * lightDot);\n let color = samplePage(position.xy + normal * (frontDistance - distance));\n front = vec4f(color.rgb * shade, color.a);\n backShade = 0.6 + 0.4 * cos(angle);\n }\n let color = samplePage(position.xy + normal * (backDistance - distance));\n let tint = (1.0 - params.back.x) * params.paperColor.a;\n back = vec4f(mix(color.rgb, params.paperColor.rgb * color.a, tint) * backShade, color.a);\n if (params.geometry.w == 1.0) { return front * coverage; }\n if (params.geometry.w == 2.0) { return back * coverage; }\n // Premultiplied source-over: the curled back covers the front, which shows through its alpha.\n return (back + front * (1.0 - back.a)) * coverage;\n}\n";
@@ -0,0 +1 @@
1
+ export { pageTurn, type PageTurnParams, type PageTurnRender, } from './page-turn/index.js';
@@ -0,0 +1,18 @@
1
+ export type SphereRender = 'both' | 'front' | 'back';
2
+ export type SphereParams = {
3
+ /** Sphere radius in pixels. Defaults to 250. */
4
+ readonly radius?: number;
5
+ /** Sphere orientation in degrees, applied in X, Y, Z order. */
6
+ readonly rotationX?: number;
7
+ readonly rotationY?: number;
8
+ readonly rotationZ?: number;
9
+ /** Center as fractions of the canvas width and height. Defaults to [0.5, 0.5]. */
10
+ readonly position?: readonly [number, number];
11
+ /** Which faces to show. Defaults to 'both'. */
12
+ readonly render?: SphereRender;
13
+ /** Darkening at the silhouette, from 0 to 1. Defaults to 0.35. */
14
+ readonly shading?: number;
15
+ };
16
+ export declare const sphere: (params?: (SphereParams & {
17
+ readonly disabled?: boolean | undefined;
18
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
@@ -0,0 +1 @@
1
+ export declare const SPHERE_SHADER = "\nstruct Params {\n resolution: vec2f,\n center: vec2f,\n radius: f32,\n padding: f32,\n shading: f32,\n faces: f32,\n rotation: vec4f,\n}\n@group(0) @binding(0) var source: texture_2d<f32>;\n@group(0) @binding(1) var sourceSampler: sampler;\n@group(0) @binding(2) var<uniform> params: Params;\n\n@vertex fn vertex(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {\n let positions = array<vec2f, 3>(vec2f(-1, -1), vec2f(3, -1), vec2f(-1, 3));\n return vec4f(positions[index], 0, 1);\n}\n\nfn sampleFace(normal: vec3f, inverse: mat3x3f) -> vec4f {\n let local = inverse * normal;\n // Longitude wraps at the seam; latitude spans the complete image height.\n let uv = vec2f(fract(atan2(local.x, local.z) / 6.28318530718 + 0.5), asin(clamp(local.y, -1.0, 1.0)) / 3.14159265359 + 0.5);\n let color = textureSampleLevel(source, sourceSampler, uv, 0);\n let shade = mix(1.0, abs(normal.z), params.shading);\n return vec4f(color.rgb * shade, color.a);\n}\n\n@fragment fn fragment(@builtin(position) position: vec4f) -> @location(0) vec4f {\n let p = (position.xy - params.center) / params.radius;\n let distanceSquared = dot(p, p);\n let coverage = 1.0 - smoothstep(1.0 - fwidth(distanceSquared), 1.0, distanceSquared);\n if (distanceSquared >= 1.0) { return vec4f(0); }\n let z = sqrt(1.0 - distanceSquared);\n let s = sin(params.rotation.xyz);\n let c = cos(params.rotation.xyz);\n let rx = mat3x3f(vec3f(1, 0, 0), vec3f(0, c.x, s.x), vec3f(0, -s.x, c.x));\n let ry = mat3x3f(vec3f(c.y, 0, -s.y), vec3f(0, 1, 0), vec3f(s.y, 0, c.y));\n let rz = mat3x3f(vec3f(c.z, s.z, 0), vec3f(-s.z, c.z, 0), vec3f(0, 0, 1));\n let inverse = transpose(rz * ry * rx);\n let front = sampleFace(vec3f(p, z), inverse);\n let back = sampleFace(vec3f(p, -z), inverse);\n if (params.faces == 1) { return front * coverage; }\n if (params.faces == 2) { return back * coverage; }\n return (front + back * (1.0 - front.a)) * coverage;\n}\n";
@@ -0,0 +1 @@
1
+ export { sphere, type SphereParams, type SphereRender } from './sphere/index.js';
@@ -0,0 +1,28 @@
1
+ declare const DISPLACEMENT_MODES: readonly ["turbulent", "bulge", "twist", "turbulent-smoother", "bulge-smoother", "twist-smoother", "vertical", "horizontal", "cross"];
2
+ declare const PINNING_MODES: readonly ["none", "all", "horizontal", "vertical", "left", "top", "right", "bottom", "all-locked", "horizontal-locked", "vertical-locked", "left-locked", "top-locked", "right-locked", "bottom-locked"];
3
+ export type TurbulentDisplaceParams = {
4
+ /** Distortion mode. Defaults to `turbulent`. */
5
+ readonly displacement?: (typeof DISPLACEMENT_MODES)[number];
6
+ /** Displacement strength in pixels. May be negative. Defaults to `50`. */
7
+ readonly amount?: number;
8
+ /** Size of the noise features in pixels. Must be at least `1`. Defaults to `100`. */
9
+ readonly size?: number;
10
+ /** Noise origin in UV coordinates. Defaults to `[0.5, 0.5]`. */
11
+ readonly offset?: readonly [number, number];
12
+ /** Number of noise layers, including fractional layers, from `1` to `10`. Defaults to `1`. */
13
+ readonly complexity?: number;
14
+ /** Noise evolution in degrees. Animate to morph the distortion. Defaults to `0`. */
15
+ readonly evolution?: number;
16
+ /** Loop the evolution after `cycle` revolutions. Defaults to `false`. */
17
+ readonly cycleEvolution?: boolean;
18
+ /** Loop length in whole revolutions. Defaults to `1`. */
19
+ readonly cycle?: number;
20
+ /** Unsigned 32-bit integer seed for repeatable distortion. Defaults to `0`. */
21
+ readonly seed?: number;
22
+ /** Edges kept in place. Locked modes also keep samples inside the source. Defaults to `all`. */
23
+ readonly pinning?: (typeof PINNING_MODES)[number];
24
+ };
25
+ export declare const turbulentDisplace: (params?: (TurbulentDisplaceParams & {
26
+ readonly disabled?: boolean | undefined;
27
+ }) | undefined) => import("remotion").EffectDescriptor<unknown>;
28
+ export {};
@@ -0,0 +1 @@
1
+ export declare const TURBULENT_DISPLACE_FRAGMENT_SHADER = "#version 300 es\nprecision highp float;\nprecision highp int;\n\nin vec2 vUv;\nout vec4 fragColor;\nuniform sampler2D uSource;\nuniform vec2 uResolution;\nuniform float uAmount;\nuniform float uSize;\nuniform vec2 uOffset;\nuniform float uComplexity;\nuniform float uEvolution;\nuniform bool uCycleEvolution;\nuniform float uCycle;\nuniform uint uSeed;\nuniform int uDisplacement;\nuniform int uPinning;\nconst int uNoiseType = 2;\n\n\nfloat lattice(ivec3 point, uint seed) {\n // Wrap lattice indices as well as coordinates so interpolation stays continuous\n // across the period boundary, including negative coordinates.\n uvec3 p = uvec3(point) & uvec3(65535u);\n uint h = p.x * 0x27d4eb2du ^ p.y * 0x165667b1u ^ p.z * 0x9e3779b9u ^ seed * 0x85ebca6bu;\n h ^= h >> 15;\n h *= 0x2c1b3c6du;\n h ^= h >> 12;\n h *= 0x297a2d39u;\n h ^= h >> 15;\n return float(h & 65535u) / 65535.0;\n}\n\nfloat catmull(vec4 p, float t) {\n return 0.5 * (2.0 * p.y + (p.z - p.x) * t\n + (2.0 * p.x - 5.0 * p.y + 4.0 * p.z - p.w) * t * t\n + (3.0 * p.y - p.x - 3.0 * p.z + p.w) * t * t * t);\n}\n\nvec3 bspline(float t) {\n return vec3(0.5 * (1.0-t) * (1.0-t), 0.5 + t * (1.0-t), 0.5 * t * t);\n}\n\nfloat sliceNoise(ivec3 p, vec2 t, uint seed) {\n if (uNoiseType == 0) return lattice(p, seed);\n if (uNoiseType == 1) {\n return mix(mix(lattice(p, seed), lattice(p + ivec3(1,0,0), seed), t.x),\n mix(lattice(p + ivec3(0,1,0), seed), lattice(p + ivec3(1,1,0), seed), t.x), t.y);\n }\n if (uNoiseType == 2) {\n vec3 wx = bspline(t.x);\n vec3 wy = bspline(t.y);\n float result = 0.0;\n for (int y = 0; y < 3; y++) {\n for (int x = 0; x < 3; x++) {\n result += wx[x] * wy[y] * lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n }\n return result;\n }\n vec4 rows;\n for (int y = 0; y < 4; y++) {\n vec4 row;\n for (int x = 0; x < 4; x++) {\n row[x] = lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n rows[y] = catmull(row, t.x);\n }\n return catmull(rows, t.y);\n}\n\nfloat valueNoise(vec3 point, uint seed) {\n // A large period keeps conversion to integer coordinates defined at extreme scales.\n vec3 p = mod(point + vec3(uNoiseType == 2 ? 0.5 : 0.0, uNoiseType == 2 ? 0.5 : 0.0, 0.0), 65536.0);\n ivec3 cell = ivec3(floor(p));\n vec3 t = fract(p);\n float fz = t.z * t.z * t.z * (t.z * (t.z * 6.0 - 15.0) + 10.0);\n float n = mix(sliceNoise(cell, t.xy, seed), sliceNoise(cell + ivec3(0,0,1), t.xy, seed), fz);\n return uNoiseType == 2 ? 0.5 + (n - 0.5) * (181.0 / 231.0) / 0.55 : n;\n}\n\n\nfloat noiseLayer(vec2 p, float z, uint seed) {\n if (!uCycleEvolution) return valueNoise(vec3(p, uEvolution + z), seed);\n float t = mod(uEvolution, uCycle);\n // Zero blend derivatives at the seam keep the looping motion smooth.\n float weight = smoothstep(0.0, 1.0, t / uCycle);\n return mix(valueNoise(vec3(p, t + z), seed), valueNoise(vec3(p, t - uCycle + z), seed), weight);\n}\n\nfloat turbulence(vec2 p, uint channel) {\n float sum = 0.0;\n float norm = 0.0;\n float amplitude = 1.0;\n float frequency = 1.0;\n float falloff = uDisplacement >= 3 && uDisplacement <= 5 ? 0.3 : 0.5;\n for (int octave = 0; octave < 10; octave++) {\n float weight = clamp(uComplexity - float(octave), 0.0, 1.0);\n if (weight == 0.0) break;\n uint seed = (uSeed ^ 0x7d15u) + channel + uint(octave) * 101u;\n sum += noiseLayer(p * frequency, float(octave) * 5.17, seed) * amplitude * weight;\n norm += amplitude * weight;\n amplitude *= falloff;\n frequency *= 2.0;\n }\n return sum / norm - 0.5;\n}\n\nvec4 readPixel(ivec2 p) {\n if (any(lessThan(p, ivec2(0))) || any(greaterThanEqual(p, ivec2(uResolution)))) return vec4(0.0);\n return texelFetch(uSource, ivec2(p.x, int(uResolution.y) - 1 - p.y), 0);\n}\n\nvec4 sampleSource(vec2 p) {\n // Bilinear interpolation with transparent samples outside the source, so\n // warped alpha edges do not smear the outermost pixel across the canvas.\n ivec2 base = ivec2(floor(p - 0.5));\n vec2 t = fract(p - 0.5);\n return mix(mix(readPixel(base), readPixel(base + ivec2(1,0)), t.x),\n mix(readPixel(base + ivec2(0,1)), readPixel(base + ivec2(1,1)), t.x), t.y);\n}\n\nvoid main() {\n if (uAmount == 0.0) {\n fragColor = texture(uSource, vUv);\n return;\n }\n vec2 pixel = vec2(vUv.x, 1.0 - vUv.y) * uResolution;\n vec2 p = (pixel - uOffset * uResolution) / uSize;\n vec2 displacement;\n if (uDisplacement == 1 || uDisplacement == 2 || uDisplacement == 4 || uDisplacement == 5) {\n float epsilon = 0.05;\n vec2 gradient = vec2(\n turbulence(p + vec2(epsilon,0), 0u) - turbulence(p - vec2(epsilon,0), 0u),\n turbulence(p + vec2(0,epsilon), 0u) - turbulence(p - vec2(0,epsilon), 0u)\n ) / (2.0 * epsilon);\n displacement = (uDisplacement == 1 || uDisplacement == 4) ? gradient : vec2(-gradient.y, gradient.x);\n displacement *= uAmount * 0.25;\n } else if (uDisplacement == 6) {\n displacement = vec2(0.0, turbulence(p, 17u) * uAmount);\n } else if (uDisplacement == 7) {\n displacement = vec2(turbulence(p, 0u) * uAmount, 0.0);\n } else if (uDisplacement == 8) {\n displacement = vec2(turbulence(p, 0u) * uAmount);\n } else {\n displacement = vec2(turbulence(p, 0u), turbulence(p, 17u)) * uAmount;\n }\n bool locked = uPinning >= 8;\n int pin = locked ? uPinning - 7 : uPinning;\n float edge = max(1.0, min(uResolution.x, uResolution.y) * (locked ? 0.25 : 0.1));\n vec2 nearEdge = clamp((pixel - 0.5) / edge, 0.0, 1.0);\n vec2 farEdge = clamp((uResolution - 0.5 - pixel) / edge, 0.0, 1.0);\n float horizontal = min(nearEdge.x, farEdge.x);\n float vertical = min(nearEdge.y, farEdge.y);\n float weight = 1.0;\n if (pin == 1) weight = min(horizontal, vertical);\n if (pin == 2) weight = vertical;\n if (pin == 3) weight = horizontal;\n if (pin == 4) weight = nearEdge.x;\n if (pin == 5) weight = nearEdge.y;\n if (pin == 6) weight = farEdge.x;\n if (pin == 7) weight = farEdge.y;\n vec2 sourcePixel = pixel + displacement * weight;\n if (locked) sourcePixel = clamp(sourcePixel, vec2(0.5), uResolution - 0.5);\n fragColor = sampleSource(sourcePixel);\n}\n";
@@ -0,0 +1 @@
1
+ export { turbulentDisplace, type TurbulentDisplaceParams, } from './turbulent-displace/index.js';
@@ -0,0 +1 @@
1
+ export declare const VALUE_NOISE_SHADER = "\nfloat lattice(ivec3 point, uint seed) {\n // Wrap lattice indices as well as coordinates so interpolation stays continuous\n // across the period boundary, including negative coordinates.\n uvec3 p = uvec3(point) & uvec3(65535u);\n uint h = p.x * 0x27d4eb2du ^ p.y * 0x165667b1u ^ p.z * 0x9e3779b9u ^ seed * 0x85ebca6bu;\n h ^= h >> 15;\n h *= 0x2c1b3c6du;\n h ^= h >> 12;\n h *= 0x297a2d39u;\n h ^= h >> 15;\n return float(h & 65535u) / 65535.0;\n}\n\nfloat catmull(vec4 p, float t) {\n return 0.5 * (2.0 * p.y + (p.z - p.x) * t\n + (2.0 * p.x - 5.0 * p.y + 4.0 * p.z - p.w) * t * t\n + (3.0 * p.y - p.x - 3.0 * p.z + p.w) * t * t * t);\n}\n\nvec3 bspline(float t) {\n return vec3(0.5 * (1.0-t) * (1.0-t), 0.5 + t * (1.0-t), 0.5 * t * t);\n}\n\nfloat sliceNoise(ivec3 p, vec2 t, uint seed) {\n if (uNoiseType == 0) return lattice(p, seed);\n if (uNoiseType == 1) {\n return mix(mix(lattice(p, seed), lattice(p + ivec3(1,0,0), seed), t.x),\n mix(lattice(p + ivec3(0,1,0), seed), lattice(p + ivec3(1,1,0), seed), t.x), t.y);\n }\n if (uNoiseType == 2) {\n vec3 wx = bspline(t.x);\n vec3 wy = bspline(t.y);\n float result = 0.0;\n for (int y = 0; y < 3; y++) {\n for (int x = 0; x < 3; x++) {\n result += wx[x] * wy[y] * lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n }\n return result;\n }\n vec4 rows;\n for (int y = 0; y < 4; y++) {\n vec4 row;\n for (int x = 0; x < 4; x++) {\n row[x] = lattice(p + ivec3(x-1, y-1, 0), seed);\n }\n rows[y] = catmull(row, t.x);\n }\n return catmull(rows, t.y);\n}\n\nfloat valueNoise(vec3 point, uint seed) {\n // A large period keeps conversion to integer coordinates defined at extreme scales.\n vec3 p = mod(point + vec3(uNoiseType == 2 ? 0.5 : 0.0, uNoiseType == 2 ? 0.5 : 0.0, 0.0), 65536.0);\n ivec3 cell = ivec3(floor(p));\n vec3 t = fract(p);\n float fz = t.z * t.z * t.z * (t.z * (t.z * 6.0 - 15.0) + 10.0);\n float n = mix(sliceNoise(cell, t.xy, seed), sliceNoise(cell + ivec3(0,0,1), t.xy, seed), fz);\n return uNoiseType == 2 ? 0.5 + (n - 0.5) * (181.0 / 231.0) / 0.55 : n;\n}\n";
@@ -0,0 +1,24 @@
1
+ export type WebGpuProjectionState = {
2
+ context: GPUCanvasContext;
3
+ resources: {
4
+ device: GPUDevice;
5
+ pipeline: GPURenderPipeline;
6
+ uniforms: GPUBuffer;
7
+ sampler: GPUSampler;
8
+ texture: GPUTexture;
9
+ bindGroup: GPUBindGroup;
10
+ width: number;
11
+ height: number;
12
+ } | null;
13
+ };
14
+ export declare const cleanupWebGpuProjection: (state: WebGpuProjectionState) => void;
15
+ export declare const setupWebGpuProjection: (target: HTMLCanvasElement, label: string) => WebGpuProjectionState;
16
+ export declare const applyWebGpuProjection: ({ state, source, width, height, device, shader, uniformData, }: {
17
+ state: WebGpuProjectionState;
18
+ source: CanvasImageSource;
19
+ width: number;
20
+ height: number;
21
+ device: GPUDevice;
22
+ shader: string;
23
+ uniformData: Float32Array<ArrayBuffer>;
24
+ }) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/effects",
3
- "version": "4.0.535",
3
+ "version": "4.0.537",
4
4
  "description": "Effects that can be applied to Remotion-based canvas components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "url": "https://github.com/remotion-dev/remotion/issues"
27
27
  },
28
28
  "dependencies": {
29
- "remotion": "4.0.535"
29
+ "remotion": "4.0.537"
30
30
  },
31
31
  "exports": {
32
32
  ".": {
@@ -39,6 +39,11 @@
39
39
  "module": "./dist/esm/barrel-distortion.mjs",
40
40
  "import": "./dist/esm/barrel-distortion.mjs"
41
41
  },
42
+ "./bevel-alpha": {
43
+ "types": "./dist/bevel-alpha.d.ts",
44
+ "module": "./dist/esm/bevel-alpha.mjs",
45
+ "import": "./dist/esm/bevel-alpha.mjs"
46
+ },
42
47
  "./blur": {
43
48
  "types": "./dist/blur.d.ts",
44
49
  "module": "./dist/esm/blur.mjs",
@@ -49,6 +54,11 @@
49
54
  "module": "./dist/esm/burlap.mjs",
50
55
  "import": "./dist/esm/burlap.mjs"
51
56
  },
57
+ "./fractal-noise": {
58
+ "types": "./dist/fractal-noise.d.ts",
59
+ "module": "./dist/esm/fractal-noise.mjs",
60
+ "import": "./dist/esm/fractal-noise.mjs"
61
+ },
52
62
  "./flannel": {
53
63
  "types": "./dist/flannel.d.ts",
54
64
  "module": "./dist/esm/flannel.mjs",
@@ -89,6 +99,11 @@
89
99
  "module": "./dist/esm/contour-lines.mjs",
90
100
  "import": "./dist/esm/contour-lines.mjs"
91
101
  },
102
+ "./cylinder": {
103
+ "types": "./dist/cylinder.d.ts",
104
+ "module": "./dist/esm/cylinder.mjs",
105
+ "import": "./dist/esm/cylinder.mjs"
106
+ },
92
107
  "./drop-shadow": {
93
108
  "types": "./dist/drop-shadow.d.ts",
94
109
  "module": "./dist/esm/drop-shadow.mjs",
@@ -199,6 +214,11 @@
199
214
  "module": "./dist/esm/linear-progressive-pixelate.mjs",
200
215
  "import": "./dist/esm/linear-progressive-pixelate.mjs"
201
216
  },
217
+ "./lens-blur": {
218
+ "types": "./dist/lens-blur.d.ts",
219
+ "module": "./dist/esm/lens-blur.mjs",
220
+ "import": "./dist/esm/lens-blur.mjs"
221
+ },
202
222
  "./levels": {
203
223
  "types": "./dist/levels.d.ts",
204
224
  "module": "./dist/esm/levels.mjs",
@@ -244,6 +264,11 @@
244
264
  "module": "./dist/esm/outline.mjs",
245
265
  "import": "./dist/esm/outline.mjs"
246
266
  },
267
+ "./page-turn": {
268
+ "types": "./dist/page-turn.d.ts",
269
+ "module": "./dist/esm/page-turn.mjs",
270
+ "import": "./dist/esm/page-turn.mjs"
271
+ },
247
272
  "./paper": {
248
273
  "types": "./dist/paper.d.ts",
249
274
  "module": "./dist/esm/paper.mjs",
@@ -319,6 +344,11 @@
319
344
  "module": "./dist/esm/speckle.mjs",
320
345
  "import": "./dist/esm/speckle.mjs"
321
346
  },
347
+ "./sphere": {
348
+ "types": "./dist/sphere.d.ts",
349
+ "module": "./dist/esm/sphere.mjs",
350
+ "import": "./dist/esm/sphere.mjs"
351
+ },
322
352
  "./starburst": {
323
353
  "types": "./dist/starburst.d.ts",
324
354
  "module": "./dist/esm/starburst.mjs",
@@ -349,6 +379,11 @@
349
379
  "module": "./dist/esm/translate.mjs",
350
380
  "import": "./dist/esm/translate.mjs"
351
381
  },
382
+ "./turbulent-displace": {
383
+ "types": "./dist/turbulent-displace.d.ts",
384
+ "module": "./dist/esm/turbulent-displace.mjs",
385
+ "import": "./dist/esm/turbulent-displace.mjs"
386
+ },
352
387
  "./tv-signal-off": {
353
388
  "types": "./dist/tv-signal-off.d.ts",
354
389
  "module": "./dist/esm/tv-signal-off.mjs",
@@ -406,12 +441,18 @@
406
441
  "barrel-distortion": [
407
442
  "dist/barrel-distortion.d.ts"
408
443
  ],
444
+ "bevel-alpha": [
445
+ "dist/bevel-alpha.d.ts"
446
+ ],
409
447
  "blur": [
410
448
  "dist/blur.d.ts"
411
449
  ],
412
450
  "burlap": [
413
451
  "dist/burlap.d.ts"
414
452
  ],
453
+ "fractal-noise": [
454
+ "dist/fractal-noise.d.ts"
455
+ ],
415
456
  "flannel": [
416
457
  "dist/flannel.d.ts"
417
458
  ],
@@ -436,6 +477,9 @@
436
477
  "contour-lines": [
437
478
  "dist/contour-lines.d.ts"
438
479
  ],
480
+ "cylinder": [
481
+ "dist/cylinder.d.ts"
482
+ ],
439
483
  "drop-shadow": [
440
484
  "dist/drop-shadow.d.ts"
441
485
  ],
@@ -502,6 +546,9 @@
502
546
  "linear-progressive-pixelate": [
503
547
  "dist/linear-progressive-pixelate.d.ts"
504
548
  ],
549
+ "lens-blur": [
550
+ "dist/lens-blur.d.ts"
551
+ ],
505
552
  "levels": [
506
553
  "dist/levels.d.ts"
507
554
  ],
@@ -529,6 +576,9 @@
529
576
  "outline": [
530
577
  "dist/outline.d.ts"
531
578
  ],
579
+ "page-turn": [
580
+ "dist/page-turn.d.ts"
581
+ ],
532
582
  "paper": [
533
583
  "dist/paper.d.ts"
534
584
  ],
@@ -574,6 +624,9 @@
574
624
  "speckle": [
575
625
  "dist/speckle.d.ts"
576
626
  ],
627
+ "sphere": [
628
+ "dist/sphere.d.ts"
629
+ ],
577
630
  "starburst": [
578
631
  "dist/starburst.d.ts"
579
632
  ],
@@ -592,6 +645,9 @@
592
645
  "translate": [
593
646
  "dist/translate.d.ts"
594
647
  ],
648
+ "turbulent-displace": [
649
+ "dist/turbulent-displace.d.ts"
650
+ ],
595
651
  "tv-signal-off": [
596
652
  "dist/tv-signal-off.d.ts"
597
653
  ],
@@ -626,11 +682,12 @@
626
682
  },
627
683
  "homepage": "https://www.remotion.dev/docs/effects/api",
628
684
  "devDependencies": {
629
- "@remotion/eslint-config-internal": "4.0.535",
685
+ "@remotion/eslint-config-internal": "4.0.537",
686
+ "@typescript/native-preview": "7.0.0-dev.20260217.1",
630
687
  "@vitest/browser-playwright": "5.0.3",
688
+ "@webgpu/types": "0.1.74",
631
689
  "eslint": "9.19.0",
632
- "vitest": "5.0.3",
633
- "@typescript/native-preview": "7.0.0-dev.20260217.1"
690
+ "vitest": "5.0.3"
634
691
  },
635
692
  "keywords": [
636
693
  "remotion",