🎥 Make videos programmatically with React
`@remotion/effects`: `chromaticAbberation()` effect (#7676)
Jonny Burger6f43ed16eac3
diff --git a/packages/docs/components/demos/index.tsx b/packages/docs/components/demos/index.tsxindex 0b6d4f493e..d2bc5f6a95 100644--- a/packages/docs/components/demos/index.tsx+++ b/packages/docs/components/demos/index.tsx@@ -3,7 +3,6 @@ import {Player} from '@remotion/player';import React, {useCallback, useMemo, useState} from 'react';import {AbsoluteFill} from 'remotion';import {Control} from './control';-import styles from './styles.module.css';import type {DemoType, Option} from './types';import {animationMathDemo,@@ -21,6 +20,7 @@ import {effectsBarrelDistortionDemo,effectsBlurDemo,effectsBrightnessDemo,+ effectsChromaticAberrationDemo,effectsContrastDemo,effectsGrayscaleDemo,effectsHalftoneDemo,@@ -72,6 +72,7 @@ import {zoomBlurPresentationDemo,zoomInOutPresentationDemo,} from './types';+import styles from './styles.module.css';const container: React.CSSProperties = {overflow: 'hidden',@@ -99,6 +100,7 @@ const demos: DemoType[] = [effectsUvTranslateDemo,effectsBarrelDistortionDemo,effectsBlurDemo,+ effectsChromaticAberrationDemo,effectsWaveDemo,effectsHalftoneDemo,arrowDemo,diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.tsindex 014bd61be4..2d89378bf4 100644--- a/packages/docs/components/demos/types.ts+++ b/packages/docs/components/demos/types.ts@@ -2,6 +2,7 @@ import type {LogLevel} from 'remotion';import {EffectsBarrelDistortionPreview} from '../effects/effects-barrel-distortion-preview';import {EffectsBlurPreview} from '../effects/effects-blur-preview';import {EffectsBrightnessPreview} from '../effects/effects-brightness-preview';+import {EffectsChromaticAberrationPreview} from '../effects/effects-chromatic-aberration-preview';import {EffectsContrastPreview} from '../effects/effects-contrast-preview';import {EffectsGrayscalePreview} from '../effects/effects-grayscale-preview';import {EffectsHalftonePreview} from '../effects/effects-halftone-preview';@@ -1789,6 +1790,38 @@ export const effectsBlurDemo: DemoType = {],};+export const effectsChromaticAberrationDemo: DemoType = {+ comp: EffectsChromaticAberrationPreview,+ compHeight: 720,+ compWidth: 1280,+ durationInFrames: 1,+ fps: 30,+ id: 'effects-chromatic-aberration',+ autoPlay: false,+ controls: false,+ logLevel: 'info',+ options: [+ {+ name: 'amount',+ type: 'numeric',+ min: 0,+ max: 100,+ step: 1,+ default: 12,+ optional: 'no',+ },+ {+ name: 'angle',+ type: 'numeric',+ min: 0,+ max: 360,+ step: 1,+ default: 0,+ optional: 'no',+ },+ ],+};+export const effectsWaveDemo: DemoType = {comp: EffectsWavePreview,compHeight: 720,diff --git a/packages/docs/components/effects/effects-chromatic-aberration-preview.tsx b/packages/docs/components/effects/effects-chromatic-aberration-preview.tsxnew file mode 100644index 0000000000..6d32d382c3--- /dev/null+++ b/packages/docs/components/effects/effects-chromatic-aberration-preview.tsx@@ -0,0 +1,18 @@+import {chromaticAberration} from '@remotion/effects/chromatic-aberration';+import React from 'react';+import {CanvasImage} from 'remotion';+import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';++export const EffectsChromaticAberrationPreview: React.FC<{+ readonly amount: number;+ readonly angle: number;+}> = ({amount, angle}) => {+ return (+ <CanvasImage+ src={EFFECTS_PREVIEW_IMAGE_SRC}+ width={1280}+ height={720}+ effects={[chromaticAberration({amount, angle})]}+ />+ );+};diff --git a/packages/docs/docs/effects/chromatic-aberration.mdx b/packages/docs/docs/effects/chromatic-aberration.mdxnew file mode 100644index 0000000000..7e21e3af8f--- /dev/null+++ b/packages/docs/docs/effects/chromatic-aberration.mdx@@ -0,0 +1,73 @@+---+image: /generated/articles-docs-effects-chromatic-aberration.png+slug: /effects/chromatic-aberration+title: chromaticAberration()+sidebar_label: chromaticAberration()+crumb: '@remotion/effects'+---++# chromaticAberration()<AvailableFrom v="4.0.467" />++_Part of the [`@remotion/effects`](/docs/effects/api) package._++A linear chromatic aberration effect that separates the red and blue channels on canvas-based components such as [`<Video>`](/docs/media/video), [`<HtmlInCanvas>`](/docs/remotion/html-in-canvas) and [`<Solid>`](/docs/solid).++Use it for an RGB split or lens-fringe look while still controlling effect order through the `effects` array.++## Preview++<Demo type="effects-chromatic-aberration" />++## Example++```tsx twoslash title="MyComp.tsx"+import {AbsoluteFill} from 'remotion';+import {Video} from '@remotion/media';+import {chromaticAberration} from '@remotion/effects/chromatic-aberration';++export const MyComp: React.FC = () => {+ return (+ <AbsoluteFill>+ <Video+ src="https://remotion.media/video.mp4"+ effects={[+ chromaticAberration({+ amount: 8,+ angle: 0,+ }),+ ]}+ />+ </AbsoluteFill>+ );+};+```++## API++Pass an object with the following properties. You can also call `chromaticAberration()` without arguments.++### `amount?`++RGB channel separation in pixels. Defaults to `8`.++Use `0` for no separation.++### `angle?`++Direction of the split in degrees. Defaults to `0`.++`0` splits horizontally. `90` splits vertically.++### `disabled?`++When `true`, the effect is skipped. Defaults to `false`.++## Requirements++`chromaticAberration()` uses a WebGL2 backend. During renders, enable WebGL via [`Config.setChromiumOpenGlRenderer()`](/docs/config#setchromiumopenglrenderer) (for example `'angle'`). See [Using WebGL during renders](/docs/remotion/html-in-canvas#using-webgl-during-renders).++## See also++- [`@remotion/effects`](/docs/effects/api)+- [`barrelDistortion()`](/docs/effects/barrel-distortion)+- [Source code for this effect](https://github.com/remotion-dev/remotion/blob/main/packages/effects/src/chromatic-aberration/index.ts)diff --git a/packages/docs/docs/effects/table-of-contents.tsx b/packages/docs/docs/effects/table-of-contents.tsxindex c9fb10d6eb..f22870966a 100644--- a/packages/docs/docs/effects/table-of-contents.tsx+++ b/packages/docs/docs/effects/table-of-contents.tsx@@ -111,6 +111,13 @@ const categories: {name: 'barrelDistortion()',description: 'Barrel distortion effect',},+ {+ link: '/docs/effects/chromatic-aberration',+ preview: '/img/effects-chromatic-aberration-preview.jpg',+ alt: 'chromatic aberration effect preview',+ name: 'chromaticAberration()',+ description: 'RGB channel split effect',+ },{link: '/docs/effects/blur',preview: '/img/effects-blur-preview.jpg',diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 84531cb19d..ef58a70ff8 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -271,6 +271,7 @@ const sidebars: SidebarsConfig = {'effects/barrel-distortion','effects/blur','effects/brightness',+ 'effects/chromatic-aberration','effects/contrast','effects/grayscale','effects/halftone',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 181f76c09f..41992cdba1 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -1745,6 +1745,15 @@ export const articles = [noAi: false,slug: 'effects/brightness',},+ {+ id: 'effects/chromatic-aberration',+ title: 'chromaticAberration()',+ relativePath: 'docs/effects/chromatic-aberration.mdx',+ compId: 'articles-docs-effects-chromatic-aberration',+ crumb: '@remotion/effects',+ noAi: false,+ slug: 'effects/chromatic-aberration',+ },{id: 'effects/contrast',title: 'contrast()',diff --git a/packages/docs/static/generated/articles-docs-effects-chromatic-aberration.png b/packages/docs/static/generated/articles-docs-effects-chromatic-aberration.pngnew file mode 100644index 0000000000..d34fe7d76dBinary files /dev/null and b/packages/docs/static/generated/articles-docs-effects-chromatic-aberration.png differdiff --git a/packages/docs/static/img/effects-chromatic-aberration-preview.jpg b/packages/docs/static/img/effects-chromatic-aberration-preview.jpgnew file mode 100644index 0000000000..d1c521ffaaBinary files /dev/null and b/packages/docs/static/img/effects-chromatic-aberration-preview.jpg differdiff --git a/packages/effects/bundle.ts b/packages/effects/bundle.tsindex 184407d65f..e8f3f1ecca 100644--- a/packages/effects/bundle.ts+++ b/packages/effects/bundle.ts@@ -9,6 +9,7 @@ const effectEntrypoints = ['src/index.ts','src/barrel-distortion.ts','src/blur.ts',+ 'src/chromatic-aberration.ts','src/brightness.ts','src/contrast.ts','src/grayscale.ts',diff --git a/packages/effects/package.json b/packages/effects/package.jsonindex ada7421ad7..be3bc33f53 100644--- a/packages/effects/package.json+++ b/packages/effects/package.json@@ -42,6 +42,11 @@"module": "./dist/esm/blur.mjs","import": "./dist/esm/blur.mjs"},+ "./chromatic-aberration": {+ "types": "./dist/chromatic-aberration.d.ts",+ "module": "./dist/esm/chromatic-aberration.mjs",+ "import": "./dist/esm/chromatic-aberration.mjs"+ },"./brightness": {"types": "./dist/brightness.d.ts","module": "./dist/esm/brightness.mjs",@@ -112,6 +117,9 @@"blur": ["dist/blur.d.ts"],+ "chromatic-aberration": [+ "dist/chromatic-aberration.d.ts"+ ],"brightness": ["dist/brightness.d.ts"],diff --git a/packages/effects/src/chromatic-aberration.ts b/packages/effects/src/chromatic-aberration.tsnew file mode 100644index 0000000000..a79305aff6--- /dev/null+++ b/packages/effects/src/chromatic-aberration.ts@@ -0,0 +1,4 @@+export {+ chromaticAberration,+ type ChromaticAberrationParams,+} from './chromatic-aberration/index.js';diff --git a/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts b/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.tsnew file mode 100644index 0000000000..084b50781e--- /dev/null+++ b/packages/effects/src/chromatic-aberration/chromatic-aberration-runtime.ts@@ -0,0 +1,219 @@+import {Internals} from 'remotion';+import {+ CHROMATIC_ABERRATION_FS,+ CHROMATIC_ABERRATION_VS,+} from './chromatic-aberration-shaders.js';++const {createWebGL2ContextError} = Internals;++export type ChromaticAberrationState = {+ gl: WebGL2RenderingContext;+ program: WebGLProgram;+ vao: WebGLVertexArrayObject;+ vbo: WebGLBuffer;+ textureSource: WebGLTexture;+ uniforms: {+ uSource: WebGLUniformLocation | null;+ uOffset: WebGLUniformLocation | null;+ };+};++const compileShader = (+ gl: WebGL2RenderingContext,+ type: number,+ source: string,+): WebGLShader => {+ const shader = gl.createShader(type);+ if (!shader) {+ throw new Error('Failed to create WebGL shader');+ }++ gl.shaderSource(shader, source);+ gl.compileShader(shader);+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {+ const log = gl.getShaderInfoLog(shader);+ gl.deleteShader(shader);+ throw new Error(`Shader compile failed: ${log ?? '(no log)'}`);+ }++ return shader;+};++const linkProgram = (+ gl: WebGL2RenderingContext,+ vs: WebGLShader,+ fs: WebGLShader,+): WebGLProgram => {+ const program = gl.createProgram();+ if (!program) {+ throw new Error('Failed to create WebGL program');+ }++ gl.attachShader(program, vs);+ gl.attachShader(program, fs);+ gl.linkProgram(program);+ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {+ const log = gl.getProgramInfoLog(program);+ gl.deleteProgram(program);+ throw new Error(`Program link failed: ${log ?? '(no log)'}`);+ }++ return program;+};++const createProgram = (+ gl: WebGL2RenderingContext,+ vertexSource: string,+ fragmentSource: string,+): WebGLProgram => {+ const vs = compileShader(gl, gl.VERTEX_SHADER, vertexSource);+ const fs = compileShader(gl, gl.FRAGMENT_SHADER, fragmentSource);+ const program = linkProgram(gl, vs, fs);+ gl.deleteShader(vs);+ gl.deleteShader(fs);+ return program;+};++const createRgbaTexture = (gl: WebGL2RenderingContext): WebGLTexture => {+ const texture = gl.createTexture();+ if (!texture) {+ throw new Error('Failed to create WebGL texture');+ }++ gl.bindTexture(gl.TEXTURE_2D, texture);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);+ gl.bindTexture(gl.TEXTURE_2D, null);+ return texture;+};++export const setupChromaticAberration = (+ target: HTMLCanvasElement,+): ChromaticAberrationState => {+ const gl = target.getContext('webgl2', {+ premultipliedAlpha: true,+ alpha: true,+ preserveDrawingBuffer: true,+ });+ if (!gl) {+ throw createWebGL2ContextError('chromatic aberration effect');+ }++ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);++ const program = createProgram(+ gl,+ CHROMATIC_ABERRATION_VS,+ CHROMATIC_ABERRATION_FS,+ );++ const vao = gl.createVertexArray();+ if (!vao) {+ throw new Error('Failed to create WebGL vertex array');+ }++ gl.bindVertexArray(vao);++ const data = new Float32Array([+ -1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1,+ ]);++ const vbo = gl.createBuffer();+ if (!vbo) {+ throw new Error('Failed to create WebGL buffer');+ }++ gl.bindBuffer(gl.ARRAY_BUFFER, vbo);+ gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);++ gl.enableVertexAttribArray(0);+ gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 16, 0);+ gl.enableVertexAttribArray(1);+ gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);++ gl.bindVertexArray(null);++ const textureSource = createRgbaTexture(gl);++ return {+ gl,+ program,+ vao,+ vbo,+ textureSource,+ uniforms: {+ uSource: gl.getUniformLocation(program, 'uSource'),+ uOffset: gl.getUniformLocation(program, 'uOffset'),+ },+ };+};++export const cleanupChromaticAberration = (+ state: ChromaticAberrationState,+): void => {+ const {gl, program, vao, vbo, textureSource} = state;+ gl.deleteTexture(textureSource);+ gl.deleteBuffer(vbo);+ gl.deleteProgram(program);+ gl.deleteVertexArray(vao);+};++const drawFullscreenQuad = (state: ChromaticAberrationState): void => {+ const {gl, vao} = state;+ gl.bindVertexArray(vao);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ gl.bindVertexArray(null);+};++export const applyChromaticAberration = ({+ state,+ source,+ width,+ height,+ amount,+ angle,+ flipSourceY,+}: {+ readonly state: ChromaticAberrationState;+ readonly source: CanvasImageSource;+ readonly width: number;+ readonly height: number;+ readonly amount: number;+ readonly angle: number;+ readonly flipSourceY: boolean;+}): void => {+ const {gl, program, textureSource, uniforms} = state;++ const radians = (angle * Math.PI) / 180;+ const x = (Math.cos(radians) * amount) / width;+ const y = (Math.sin(radians) * amount) / height;++ gl.viewport(0, 0, width, height);+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY);+ gl.bindTexture(gl.TEXTURE_2D, textureSource);+ gl.texImage2D(+ gl.TEXTURE_2D,+ 0,+ gl.RGBA,+ gl.RGBA,+ gl.UNSIGNED_BYTE,+ source as TexImageSource,+ );+ gl.bindTexture(gl.TEXTURE_2D, null);++ gl.bindFramebuffer(gl.FRAMEBUFFER, null);+ gl.clearColor(0, 0, 0, 0);+ gl.clear(gl.COLOR_BUFFER_BIT);++ gl.useProgram(program);+ if (uniforms.uSource) gl.uniform1i(uniforms.uSource, 0);+ if (uniforms.uOffset) gl.uniform2f(uniforms.uOffset, x, y);++ gl.activeTexture(gl.TEXTURE0);+ gl.bindTexture(gl.TEXTURE_2D, textureSource);+ drawFullscreenQuad(state);+ gl.bindTexture(gl.TEXTURE_2D, null);+ gl.useProgram(null);+};diff --git a/packages/effects/src/chromatic-aberration/chromatic-aberration-shaders.ts b/packages/effects/src/chromatic-aberration/chromatic-aberration-shaders.tsnew file mode 100644index 0000000000..27f734a3ee--- /dev/null+++ b/packages/effects/src/chromatic-aberration/chromatic-aberration-shaders.ts@@ -0,0 +1,26 @@+export const CHROMATIC_ABERRATION_VS = /* glsl */ `#version 300 es+layout(location = 0) in vec2 aPos;+layout(location = 1) in vec2 aUv;+out vec2 vUv;+void main() {+ vUv = aUv;+ gl_Position = vec4(aPos, 0.0, 1.0);+}+`;++export const CHROMATIC_ABERRATION_FS = /* glsl */ `#version 300 es+precision highp float;+in vec2 vUv;+out vec4 fragColor;++uniform sampler2D uSource;+uniform vec2 uOffset;++void main() {+ vec4 redSample = texture(uSource, vUv - uOffset);+ vec4 centerSample = texture(uSource, vUv);+ vec4 blueSample = texture(uSource, vUv + uOffset);++ fragColor = vec4(redSample.r, centerSample.g, blueSample.b, centerSample.a);+}+`;diff --git a/packages/effects/src/chromatic-aberration/index.ts b/packages/effects/src/chromatic-aberration/index.tsnew file mode 100644index 0000000000..cc1c9a92b1--- /dev/null+++ b/packages/effects/src/chromatic-aberration/index.ts@@ -0,0 +1,96 @@+import type {SequenceSchema} from 'remotion';+import {Internals} from 'remotion';+import {+ assertOptionalFiniteNumber,+ validateNonNegative,+} from '../color-utils.js';+import {assertEffectParamsObject} from '../validate-effect-param.js';+import {+ applyChromaticAberration,+ cleanupChromaticAberration,+ setupChromaticAberration,+ type ChromaticAberrationState,+} from './chromatic-aberration-runtime.js';++const {createEffect} = Internals;++const DEFAULT_CHROMATIC_ABERRATION_AMOUNT = 8 as const;+const DEFAULT_CHROMATIC_ABERRATION_ANGLE = 0 as const;++const chromaticAberrationSchema = {+ amount: {+ type: 'number',+ min: 0,+ max: 100,+ step: 1,+ default: DEFAULT_CHROMATIC_ABERRATION_AMOUNT,+ description: 'Amount',+ },+ angle: {+ type: 'number',+ step: 1,+ default: DEFAULT_CHROMATIC_ABERRATION_ANGLE,+ description: 'Angle',+ },+} as const satisfies SequenceSchema;++export type ChromaticAberrationParams = {+ /** RGB channel separation in pixels. Defaults to `8`. */+ readonly amount?: number;+ /** Direction of the split in degrees. Defaults to `0`. */+ readonly angle?: number;+};++type ChromaticAberrationResolved = {+ readonly amount: number;+ readonly angle: number;+};++const resolve = (+ params: ChromaticAberrationParams,+): ChromaticAberrationResolved => ({+ amount: params.amount ?? DEFAULT_CHROMATIC_ABERRATION_AMOUNT,+ angle: params.angle ?? DEFAULT_CHROMATIC_ABERRATION_ANGLE,+});++const validateChromaticAberrationParams = (+ params: ChromaticAberrationParams,+): void => {+ assertEffectParamsObject(params, 'Chromatic Aberration');+ assertOptionalFiniteNumber(params.amount, 'amount');+ assertOptionalFiniteNumber(params.angle, 'angle');++ const resolved = resolve(params);+ validateNonNegative(resolved.amount, 'amount');+};++export const chromaticAberration = createEffect<+ ChromaticAberrationParams,+ ChromaticAberrationState+>({+ type: 'remotion/chromatic-aberration',+ label: 'Chromatic Aberration',+ documentationLink:+ 'https://www.remotion.dev/docs/effects/chromatic-aberration',+ backend: 'webgl2',+ calculateKey: (params) => {+ const resolved = resolve(params);+ return `chromatic-aberration-${resolved.amount}-${resolved.angle}`;+ },+ setup: (target) => setupChromaticAberration(target),+ apply: ({source, width, height, params, state, flipSourceY}) => {+ const resolved = resolve(params);+ applyChromaticAberration({+ state,+ source,+ width,+ height,+ amount: resolved.amount,+ angle: resolved.angle,+ flipSourceY,+ });+ },+ cleanup: (state) => cleanupChromaticAberration(state),+ schema: chromaticAberrationSchema,+ validateParams: validateChromaticAberrationParams,+});diff --git a/packages/effects/src/test/effect-params.test.ts b/packages/effects/src/test/effect-params.test.tsindex 01c2f7da51..3e19b46d5d 100644--- a/packages/effects/src/test/effect-params.test.ts+++ b/packages/effects/src/test/effect-params.test.ts@@ -2,6 +2,7 @@ import {expect, test} from 'bun:test';import {barrelDistortion} from '../barrel-distortion/index.js';import {blur} from '../blur/index.js';import {brightness} from '../brightness.js';+import {chromaticAberration} from '../chromatic-aberration/index.js';import {contrast} from '../contrast.js';import {grayscale} from '../grayscale.js';import {halftone} from '../halftone.js';@@ -21,6 +22,9 @@ test('@remotion/effects expose documentation links', () => {expect(blur({radius: 1}).definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/blur',);+ expect(chromaticAberration().definition.documentationLink).toBe(+ 'https://www.remotion.dev/docs/effects/chromatic-aberration',+ );expect(brightness().definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/brightness',);@@ -90,6 +94,38 @@ test('barrelDistortion() amount produces distinct effect keys', () => {expect(none.effectKey).not.toBe(strong.effectKey);});+test('chromaticAberration() accepts default params', () => {+ expect(() => chromaticAberration()).not.toThrow();+});++test('chromaticAberration() rejects non-finite amount', () => {+ expect(() => chromaticAberration({amount: Number.NaN})).toThrow(+ '"amount" must be a finite number',+ );+});++test('chromaticAberration() rejects negative amount', () => {+ expect(() => chromaticAberration({amount: -1})).toThrow(+ '"amount" must be >= 0',+ );+});++test('chromaticAberration() rejects non-finite angle', () => {+ expect(() => chromaticAberration({angle: Number.NaN})).toThrow(+ '"angle" must be a finite number',+ );+});++test('chromaticAberration() parameters produce distinct effect keys', () => {+ const none = chromaticAberration({amount: 0});+ const shifted = chromaticAberration({amount: 8});+ const angled = chromaticAberration({amount: 8, angle: 45});++ expect(+ new Set([none.effectKey, shifted.effectKey, angled.effectKey]).size,+ ).toBe(3);+});+test('tint() throws when color is not passed', () => {expect(() => tint({} as Parameters<typeof tint>[0])).toThrow('"color" must be a non-empty string, but got undefined',