🎥 Make videos programmatically with React
`@remotion/effects`: Add radial progressive blur (#8638)
Jonny Burger41c0e5b5125e
diff --git a/packages/core/src/interactivity-schema.ts b/packages/core/src/interactivity-schema.tsindex bf8f4dce51..04ef4da232 100644--- a/packages/core/src/interactivity-schema.ts+++ b/packages/core/src/interactivity-schema.ts@@ -70,7 +70,18 @@ export type UvCoordinateFieldSchema = {min?: number;max?: number;step?: number;- lineTo?: string;+ visual?:+ | {+ readonly type: 'line';+ readonly to: string;+ }+ | {+ readonly type: 'ellipse';+ readonly width: string;+ readonly height: string;+ readonly rotation?: string;+ readonly innerScale?: string;+ };default: readonly [number, number] | undefined;description?: string;keyframable?: boolean;diff --git a/packages/docs/components/effects-demos/registry.ts b/packages/docs/components/effects-demos/registry.tsindex 9419831fb5..3bf50b082d 100644--- a/packages/docs/components/effects-demos/registry.ts+++ b/packages/docs/components/effects-demos/registry.ts@@ -30,6 +30,7 @@ import {noiseDisplacement} from '@remotion/effects/noise-displacement';import {pattern} from '@remotion/effects/pattern';import {pixelDissolve} from '@remotion/effects/pixel-dissolve';import {pixelate} from '@remotion/effects/pixelate';+import {radialProgressiveBlur} from '@remotion/effects/radial-progressive-blur';import {rings} from '@remotion/effects/rings';import {saturation} from '@remotion/effects/saturation';import {scale} from '@remotion/effects/scale';@@ -92,6 +93,10 @@ import {import {EffectsPatternPreview} from '../effects/effects-pattern-preview';import {EffectsPixelDissolvePreview} from '../effects/effects-pixel-dissolve-preview';import {EffectsPixelatePreview} from '../effects/effects-pixelate-preview';+import {+ EffectsRadialProgressiveBlurPreview,+ RADIAL_PROGRESSIVE_BLUR_PREVIEW_PARAMS,+} from '../effects/effects-radial-progressive-blur-preview';import {EffectsRingsPreview} from '../effects/effects-rings-preview';import {EffectsSaturationPreview} from '../effects/effects-saturation-preview';import {EffectsScalePreview} from '../effects/effects-scale-preview';@@ -448,6 +453,15 @@ export const effectsDemos: EffectsDemoType[] = [comp: EffectsLinearProgressiveBlurPreview,schema: linearProgressiveBlur().definition.schema,},+ {+ ...defaults,+ id: 'effects-radial-progressive-blur',+ effectName: 'radialProgressiveBlur',+ effectImportPath: '@remotion/effects/radial-progressive-blur',+ comp: EffectsRadialProgressiveBlurPreview,+ schema: radialProgressiveBlur().definition.schema,+ initialValues: RADIAL_PROGRESSIVE_BLUR_PREVIEW_PARAMS,+ },{...defaults,id: 'effects-light-trail',diff --git a/packages/docs/components/effects/effects-radial-progressive-blur-preview.tsx b/packages/docs/components/effects/effects-radial-progressive-blur-preview.tsxnew file mode 100644index 0000000000..9f7140f615--- /dev/null+++ b/packages/docs/components/effects/effects-radial-progressive-blur-preview.tsx@@ -0,0 +1,44 @@+import {radialProgressiveBlur} from '@remotion/effects/radial-progressive-blur';+import React from 'react';+import {CanvasImage} from 'remotion';+import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';++export const RADIAL_PROGRESSIVE_BLUR_PREVIEW_PARAMS = {+ center: [0.48, 0.5],+ width: 1.29,+ height: 1,+ rotation: 0,+ start: 0.75,+ startBlur: 0,+ endBlur: 200,+} as const;++export const EffectsRadialProgressiveBlurPreview: React.FC<{+ readonly center: readonly [number, number];+ readonly width: number;+ readonly height: number;+ readonly rotation: number;+ readonly start: number;+ readonly startBlur: number;+ readonly endBlur: number;+}> = ({center, width, height, rotation, start, startBlur, endBlur}) => {+ return (+ <CanvasImage+ src={EFFECTS_PREVIEW_IMAGE_SRC}+ width={1280}+ height={720}+ fit="cover"+ effects={[+ radialProgressiveBlur({+ center,+ width,+ height,+ rotation,+ start,+ startBlur,+ endBlur,+ }),+ ]}+ />+ );+};diff --git a/packages/docs/docs/effects/radial-progressive-blur.mdx b/packages/docs/docs/effects/radial-progressive-blur.mdxnew file mode 100644index 0000000000..4fd3615398--- /dev/null+++ b/packages/docs/docs/effects/radial-progressive-blur.mdx@@ -0,0 +1,118 @@+---+image: /generated/articles-docs-effects-radial-progressive-blur.png+slug: /effects/radial-progressive-blur+title: radialProgressiveBlur()+sidebar_label: radialProgressiveBlur()+crumb: '@remotion/effects'+---++# radialProgressiveBlur()<AvailableFrom v="4.0.483" />++_Part of the [`@remotion/effects`](/docs/effects/api) package._++A Gaussian blur whose radius changes from a center point to the edge of an ellipse.++Use it for depth-of-field, spotlight focus, and radial softening on canvas-based components such as [`<Video>`](/docs/media/video), [`<HtmlInCanvas>`](/docs/remotion/html-in-canvas) and [`<Solid>`](/docs/solid).++## Preview++<EffectsDemo type="effects-radial-progressive-blur" />++## Example++```tsx twoslash title="MyComp.tsx"+import {AbsoluteFill} from 'remotion';+import {Video} from '@remotion/media';+import {radialProgressiveBlur} from '@remotion/effects/radial-progressive-blur';++export const MyComp: React.FC = () => {+ return (+ <AbsoluteFill>+ <Video+ src="https://remotion.media/video.mp4"+ effects={[+ radialProgressiveBlur({+ center: [0.48, 0.5],+ width: 1.29,+ height: 1,+ rotation: 0,+ start: 0.75,+ startBlur: 0,+ endBlur: 200,+ }),+ ]}+ />+ </AbsoluteFill>+ );+};+```++## API++Pass an object with the following properties. You can also call `radialProgressiveBlur()` without arguments.++### `center?`++UV coordinate where `startBlur` is reached. Defaults to `[0.5, 0.5]`.++Pass a `[number, number]` tuple where `[0, 0]` is top-left and `[1, 1]` is bottom-right.++The accepted range in the visual editor is `[-1, 2]` for each coordinate. Values outside `[0, 1]` place the center outside the visible area.++### `width?`++Full ellipse width in UV coordinates. Defaults to `1`.++For example, `width: 0.5` makes the ellipse half as wide as the canvas.++### `height?`++Full ellipse height in UV coordinates. Defaults to `1`.++For example, `height: 0.5` makes the ellipse half as tall as the canvas.++### `rotation?`++Ellipse rotation in degrees. Defaults to `0`.++### `start?`++Normalized ellipse progress where `startBlur` is reached. Defaults to `0`.++`0` is the center. `1` is the outer ellipse line defined by `width`, `height`, and `rotation`.++Values between `0` and `1` use the same ellipse shape as a multiplier. For example, `start: 0.5` starts the blur halfway between the center and the outer ellipse.++### `startBlur?`++Blur radius in pixels at `start`. Defaults to `0`.++Negative values are clamped to `0`.++### `endBlur?`++Blur radius in pixels at the outer ellipse. Defaults to `50`.++Negative values are clamped to `0`.++### `disabled?`++When `true`, the effect is skipped. Defaults to `false`.++## Behavior++The blur radius is interpolated between `startBlur` and `endBlur` from `start` to the outer ellipse.++Before `start`, the radius is clamped to `startBlur`. At and beyond the outer ellipse, the radius is clamped to `endBlur`.++## Requirements++`radialProgressiveBlur()` uses a WebGL2 backend. During renders, enable WebGL via [`Config.setChromiumOpenGlRenderer('angle')`](/docs/config#setchromiumopenglrenderer). See [Using WebGL during renders](/docs/remotion/html-in-canvas#using-webgl-during-renders).++## See also++- [`@remotion/effects`](/docs/effects/api)+- [`blur()`](/docs/effects/blur)+- [`linearProgressiveBlur()`](/docs/effects/linear-progressive-blur)+- [HTML-in-canvas guide](/docs/html-in-canvas)+- [Source code for this effect](https://github.com/remotion-dev/remotion/blob/main/packages/effects/src/radial-progressive-blur/index.ts)diff --git a/packages/docs/docs/interactivity-schema.mdx b/packages/docs/docs/interactivity-schema.mdxindex cc1739add1..c1c38aca97 100644--- a/packages/docs/docs/interactivity-schema.mdx+++ b/packages/docs/docs/interactivity-schema.mdx@@ -99,6 +99,74 @@ Shows a scale control. The value may be a number or a CSS scale string.Shows a normalized two-dimensional coordinate as `[x, y]`.+`[0, 0]` is the top-left corner and `[1, 1]` is the bottom-right corner.++#### `visual?`++Optional metadata for drawing related Visual Mode controls in the preview.++This metadata does not change the stored value. It only tells Remotion Studio how a `uv-coordinate` relates to other schema fields.++##### Line++Draws a line from this coordinate to another `uv-coordinate` field in the same schema.++```ts+start: {+ type: 'uv-coordinate',+ default: [0, 0],+ visual: {+ type: 'line',+ to: 'end',+ },+},+end: {+ type: 'uv-coordinate',+ default: [1, 1],+},+```++##### Ellipse++Draws an ellipse centered on this coordinate. The `width`, `height`, `rotation` and `innerScale` properties point to numeric fields in the same schema.++```ts+center: {+ type: 'uv-coordinate',+ default: [0.5, 0.5],+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+},+width: {+ type: 'number',+ default: 1,+ hiddenFromList: false,+},+height: {+ type: 'number',+ default: 1,+ hiddenFromList: false,+},+rotation: {+ type: 'rotation-degrees',+ default: 0,+},+start: {+ type: 'number',+ min: 0,+ max: 1,+ default: 0,+ hiddenFromList: false,+},+```++`innerScale` is optional. When present, Remotion Studio draws a second ellipse using the same center, width, height and rotation multiplied by that numeric field.+### `hidden`Keeps a field in the schema without rendering a visible control.diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex a685645c98..79890efe9e 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -305,6 +305,7 @@ const sidebars: SidebarsConfig = {'effects/pattern','effects/pixel-dissolve','effects/pixelate',+ 'effects/radial-progressive-blur','effects/rings','effects/saturation','effects/scale',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 73ef106325..050ad2a841 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -2033,6 +2033,15 @@ export const articles = [noAi: false,slug: 'effects/pixelate',},+ {+ id: 'effects/radial-progressive-blur',+ title: 'radialProgressiveBlur()',+ relativePath: 'docs/effects/radial-progressive-blur.mdx',+ compId: 'articles-docs-effects-radial-progressive-blur',+ crumb: '@remotion/effects',+ noAi: false,+ slug: 'effects/radial-progressive-blur',+ },{id: 'effects/rings',title: 'rings()',diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsxindex f41c6087fe..6ef1382f95 100644--- a/packages/docs/src/remotion/Root.tsx+++ b/packages/docs/src/remotion/Root.tsx@@ -43,6 +43,10 @@ import {EffectsNoisePreview} from '../../components/effects/effects-noise-previeimport {EffectsPatternPreview} from '../../components/effects/effects-pattern-preview';import {EffectsPixelDissolvePreview} from '../../components/effects/effects-pixel-dissolve-preview';import {EffectsPixelatePreview} from '../../components/effects/effects-pixelate-preview';+import {+ EffectsRadialProgressiveBlurPreview,+ RADIAL_PROGRESSIVE_BLUR_PREVIEW_PARAMS,+} from '../../components/effects/effects-radial-progressive-blur-preview';import {EffectsRingsPreview} from '../../components/effects/effects-rings-preview';import {EffectsSaturationPreview} from '../../components/effects/effects-saturation-preview';import {EffectsScalePreview} from '../../components/effects/effects-scale-preview';@@ -383,6 +387,13 @@ export const RemotionRoot: React.FC = () => {endBlur: 50,}}/>+ <Still+ id="effects-radial-progressive-blur-preview"+ component={EffectsRadialProgressiveBlurPreview}+ width={1280}+ height={720}+ defaultProps={RADIAL_PROGRESSIVE_BLUR_PREVIEW_PARAMS}+ /><Stillid="effects-light-trail-text-source"component={LightTrailTextSource}diff --git a/packages/docs/static/generated/articles-docs-effects-radial-progressive-blur.png b/packages/docs/static/generated/articles-docs-effects-radial-progressive-blur.pngnew file mode 100644index 0000000000..20a8011cc5Binary files /dev/null and b/packages/docs/static/generated/articles-docs-effects-radial-progressive-blur.png differdiff --git a/packages/docs/static/img/effects-radial-progressive-blur-preview.png b/packages/docs/static/img/effects-radial-progressive-blur-preview.pngnew file mode 100644index 0000000000..49d98af8c4Binary files /dev/null and b/packages/docs/static/img/effects-radial-progressive-blur-preview.png differdiff --git a/packages/effects/bundle.ts b/packages/effects/bundle.tsindex c3b16d8f15..59cd74120f 100644--- a/packages/effects/bundle.ts+++ b/packages/effects/bundle.ts@@ -39,6 +39,7 @@ const effectEntrypoints = ['src/noise.ts','src/noise-displacement.ts','src/pattern.ts',+ 'src/radial-progressive-blur.ts','src/rings.ts','src/saturation.ts','src/scanlines.ts',diff --git a/packages/effects/package.json b/packages/effects/package.jsonindex 4914f0ab4d..ca906136e9 100644--- a/packages/effects/package.json+++ b/packages/effects/package.json@@ -194,6 +194,11 @@"module": "./dist/esm/pattern.mjs","import": "./dist/esm/pattern.mjs"},+ "./radial-progressive-blur": {+ "types": "./dist/radial-progressive-blur.d.ts",+ "module": "./dist/esm/radial-progressive-blur.mjs",+ "import": "./dist/esm/radial-progressive-blur.mjs"+ },"./rings": {"types": "./dist/rings.d.ts","module": "./dist/esm/rings.mjs",@@ -379,6 +384,9 @@"pattern": ["dist/pattern.d.ts"],+ "radial-progressive-blur": [+ "dist/radial-progressive-blur.d.ts"+ ],"rings": ["dist/rings.d.ts"],diff --git a/packages/effects/src/halftone-linear-gradient.ts b/packages/effects/src/halftone-linear-gradient.tsindex 8afbb2e98a..1a1da0b018 100644--- a/packages/effects/src/halftone-linear-gradient.ts+++ b/packages/effects/src/halftone-linear-gradient.ts@@ -49,7 +49,10 @@ export const halftoneLinearGradientSchema = {step: 0.01,default: DEFAULT_FIRST_STOP_POSITION,description: 'First stop position',- lineTo: 'secondStopPosition',+ visual: {+ type: 'line',+ to: 'secondStopPosition',+ },},secondStopPosition: {type: 'uv-coordinate',diff --git a/packages/effects/src/linear-progressive-blur/index.ts b/packages/effects/src/linear-progressive-blur/index.tsindex 4435f1649b..f3017a5681 100644--- a/packages/effects/src/linear-progressive-blur/index.ts+++ b/packages/effects/src/linear-progressive-blur/index.ts@@ -52,7 +52,10 @@ const linearProgressiveBlurSchema = {step: 0.01,default: DEFAULT_START,description: 'Start',- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },},end: {type: 'uv-coordinate',diff --git a/packages/effects/src/radial-progressive-blur.ts b/packages/effects/src/radial-progressive-blur.tsnew file mode 100644index 0000000000..861a1fa8b0--- /dev/null+++ b/packages/effects/src/radial-progressive-blur.ts@@ -0,0 +1,5 @@+export {+ radialProgressiveBlur,+ type RadialProgressiveBlurParams,+ type RadialProgressiveBlurUvCoordinate,+} from './radial-progressive-blur/index.js';diff --git a/packages/effects/src/radial-progressive-blur/index.ts b/packages/effects/src/radial-progressive-blur/index.tsnew file mode 100644index 0000000000..4f19609e47--- /dev/null+++ b/packages/effects/src/radial-progressive-blur/index.ts@@ -0,0 +1,211 @@+import type {InteractivitySchema} from 'remotion';+import {Internals} from 'remotion';+import {+ assertOptionalFiniteNumber,+ validateNonNegative,+ validateUnitInterval,+} from '../color-utils.js';+import {assertEffectParamsObject} from '../validate-effect-param.js';+import {+ applyRadialProgressiveBlur,+ cleanupRadialProgressiveBlur,+ setupRadialProgressiveBlur,+ type RadialProgressiveBlurState,+} from './radial-progressive-blur-runtime.js';++const {createEffect} = Internals;++const DEFAULT_CENTER = [0.5, 0.5] as const;+const DEFAULT_WIDTH = 1;+const DEFAULT_HEIGHT = 1;+const DEFAULT_ROTATION = 0;+const DEFAULT_START = 0;+const DEFAULT_START_BLUR = 0;+const DEFAULT_END_BLUR = 50;++export type RadialProgressiveBlurUvCoordinate = readonly [number, number];++export type RadialProgressiveBlurParams = {+ /**+ * UV coordinate where `startBlur` is reached. Defaults to `[0.5, 0.5]`.+ */+ readonly center?: RadialProgressiveBlurUvCoordinate;+ /**+ * Full ellipse width in UV coordinates. Defaults to `1`.+ */+ readonly width?: number;+ /**+ * Full ellipse height in UV coordinates. Defaults to `1`.+ */+ readonly height?: number;+ /**+ * Ellipse rotation in degrees. Defaults to `0`.+ */+ readonly rotation?: number;+ /**+ * Normalized ellipse progress where `startBlur` is reached. `0` is the+ * center and `1` is the ellipse line. Defaults to `0`.+ */+ readonly start?: number;+ /**+ * Blur radius in pixels at `start`. Defaults to `0`.+ */+ readonly startBlur?: number;+ /**+ * Blur radius in pixels at the outer ellipse. Defaults to `50`.+ */+ readonly endBlur?: number;+};++export type RadialProgressiveBlurResolved = {+ readonly center: RadialProgressiveBlurUvCoordinate;+ readonly width: number;+ readonly height: number;+ readonly rotation: number;+ readonly start: number;+ readonly startBlur: number;+ readonly endBlur: number;+};++const radialProgressiveBlurSchema = {+ center: {+ type: 'uv-coordinate',+ min: -1,+ max: 2,+ step: 0.01,+ default: DEFAULT_CENTER,+ description: 'Center',+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ },+ width: {+ type: 'number',+ min: 0,+ step: 0.01,+ default: DEFAULT_WIDTH,+ description: 'Width',+ hiddenFromList: false,+ },+ height: {+ type: 'number',+ min: 0,+ step: 0.01,+ default: DEFAULT_HEIGHT,+ description: 'Height',+ hiddenFromList: false,+ },+ rotation: {+ type: 'rotation-degrees',+ step: 1,+ default: DEFAULT_ROTATION,+ description: 'Rotation',+ },+ start: {+ type: 'number',+ min: 0,+ max: 1,+ step: 0.01,+ default: DEFAULT_START,+ description: 'Start',+ hiddenFromList: false,+ },+ startBlur: {+ type: 'number',+ min: 0,+ max: 200,+ step: 1,+ default: DEFAULT_START_BLUR,+ description: 'Start blur',+ hiddenFromList: false,+ },+ endBlur: {+ type: 'number',+ min: 0,+ max: 200,+ step: 1,+ default: DEFAULT_END_BLUR,+ description: 'End blur',+ hiddenFromList: false,+ },+} as const satisfies InteractivitySchema;++const clampBlur = (value: number): number => Math.max(0, value);++const resolveRadialProgressiveBlurParams = (+ params: RadialProgressiveBlurParams,+): RadialProgressiveBlurResolved => ({+ center: [+ ...(params.center ?? DEFAULT_CENTER),+ ] as RadialProgressiveBlurUvCoordinate,+ width: params.width ?? DEFAULT_WIDTH,+ height: params.height ?? DEFAULT_HEIGHT,+ rotation: params.rotation ?? DEFAULT_ROTATION,+ start: params.start ?? DEFAULT_START,+ startBlur: clampBlur(params.startBlur ?? DEFAULT_START_BLUR),+ endBlur: clampBlur(params.endBlur ?? DEFAULT_END_BLUR),+});++const assertOptionalUvCoordinate = (value: unknown, name: string): void => {+ if (value === undefined) {+ return;+ }++ if (+ !Array.isArray(value) ||+ value.length !== 2 ||+ value.some((item) => typeof item !== 'number' || !Number.isFinite(item))+ ) {+ throw new TypeError(`"${name}" must be a [number, number] tuple`);+ }+};++const validateRadialProgressiveBlurParams = (+ params: RadialProgressiveBlurParams,+): void => {+ assertEffectParamsObject(params, 'Radial progressive blur');+ assertOptionalUvCoordinate(params.center, 'center');+ assertOptionalFiniteNumber(params.width, 'width');+ assertOptionalFiniteNumber(params.height, 'height');+ assertOptionalFiniteNumber(params.rotation, 'rotation');+ validateNonNegative(params.width ?? DEFAULT_WIDTH, 'width');+ validateNonNegative(params.height ?? DEFAULT_HEIGHT, 'height');+ assertOptionalFiniteNumber(params.start, 'start');+ validateUnitInterval(params.start ?? DEFAULT_START, 'start');+ assertOptionalFiniteNumber(params.startBlur, 'startBlur');+ assertOptionalFiniteNumber(params.endBlur, 'endBlur');+};++export const radialProgressiveBlur = createEffect<+ RadialProgressiveBlurParams,+ RadialProgressiveBlurState+>({+ type: 'dev.remotion.effects.radialProgressiveBlur',+ label: 'radialProgressiveBlur()',+ documentationLink:+ 'https://www.remotion.dev/docs/effects/radial-progressive-blur',+ backend: 'webgl2',+ calculateKey: (params) => {+ const r = resolveRadialProgressiveBlurParams(params);+ return `radial-progressive-blur-${r.center.join(':')}-${r.width}-${r.height}-${r.rotation}-${r.start}-${r.startBlur}-${r.endBlur}`;+ },+ setup: (target) => setupRadialProgressiveBlur(target),+ apply: ({source, width, height, params, state, flipSourceY}) => {+ const r = resolveRadialProgressiveBlurParams(params);+ applyRadialProgressiveBlur({+ state,+ source,+ width,+ height,+ params: r,+ flipSourceY,+ });+ },+ cleanup: (state) => cleanupRadialProgressiveBlur(state),+ schema: radialProgressiveBlurSchema,+ validateParams: validateRadialProgressiveBlurParams,+});diff --git a/packages/effects/src/radial-progressive-blur/radial-progressive-blur-runtime.ts b/packages/effects/src/radial-progressive-blur/radial-progressive-blur-runtime.tsnew file mode 100644index 0000000000..2d19adb782--- /dev/null+++ b/packages/effects/src/radial-progressive-blur/radial-progressive-blur-runtime.ts@@ -0,0 +1,395 @@+import {Internals} from 'remotion';+import type {RadialProgressiveBlurResolved} from './index.js';+import {+ buildRadialProgressiveBlurFs,+ RADIAL_PROGRESSIVE_BLUR_VS,+} from './radial-progressive-blur-shaders.js';++const {createWebGL2ContextError} = Internals;++type RadialProgressiveBlurUniforms = {+ readonly uSource: WebGLUniformLocation | null;+ readonly uTexelSize: WebGLUniformLocation | null;+ readonly uCenter: WebGLUniformLocation | null;+ readonly uWidth: WebGLUniformLocation | null;+ readonly uHeight: WebGLUniformLocation | null;+ readonly uRotation: WebGLUniformLocation | null;+ readonly uStart: WebGLUniformLocation | null;+ readonly uStartBlur: WebGLUniformLocation | null;+ readonly uEndBlur: WebGLUniformLocation | null;+};++export type RadialProgressiveBlurState = {+ readonly gl: WebGL2RenderingContext;+ readonly programHorizontal: WebGLProgram;+ readonly programVertical: WebGLProgram;+ readonly vao: WebGLVertexArrayObject;+ readonly vbo: WebGLBuffer;+ readonly textureSource: WebGLTexture;+ readonly textureIntermediate: WebGLTexture;+ readonly framebuffer: WebGLFramebuffer;+ readonly horizontal: RadialProgressiveBlurUniforms;+ readonly vertical: RadialProgressiveBlurUniforms;+};++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(+ `Radial progressive blur 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(+ `Radial progressive blur 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 getUniforms = (+ gl: WebGL2RenderingContext,+ program: WebGLProgram,+): RadialProgressiveBlurUniforms => ({+ uSource: gl.getUniformLocation(program, 'uSource'),+ uTexelSize: gl.getUniformLocation(program, 'uTexelSize'),+ uCenter: gl.getUniformLocation(program, 'uCenter'),+ uWidth: gl.getUniformLocation(program, 'uWidth'),+ uHeight: gl.getUniformLocation(program, 'uHeight'),+ uRotation: gl.getUniformLocation(program, 'uRotation'),+ uStart: gl.getUniformLocation(program, 'uStart'),+ uStartBlur: gl.getUniformLocation(program, 'uStartBlur'),+ uEndBlur: gl.getUniformLocation(program, 'uEndBlur'),+});++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 setupRadialProgressiveBlur = (+ target: HTMLCanvasElement,+): RadialProgressiveBlurState => {+ const gl = target.getContext('webgl2', {+ premultipliedAlpha: true,+ alpha: true,+ preserveDrawingBuffer: true,+ });+ if (!gl) {+ throw createWebGL2ContextError('radial progressive blur effect');+ }++ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);++ const programHorizontal = createProgram(+ gl,+ RADIAL_PROGRESSIVE_BLUR_VS,+ buildRadialProgressiveBlurFs('horizontal'),+ );+ const programVertical = createProgram(+ gl,+ RADIAL_PROGRESSIVE_BLUR_VS,+ buildRadialProgressiveBlurFs('vertical'),+ );++ 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);+ const textureIntermediate = createRgbaTexture(gl);++ const framebuffer = gl.createFramebuffer();+ if (!framebuffer) {+ throw new Error('Failed to create WebGL framebuffer');+ }++ const w = Math.max(1, target.width);+ const h = Math.max(1, target.height);+ gl.bindTexture(gl.TEXTURE_2D, textureIntermediate);+ gl.texImage2D(+ gl.TEXTURE_2D,+ 0,+ gl.RGBA,+ w,+ h,+ 0,+ gl.RGBA,+ gl.UNSIGNED_BYTE,+ null,+ );+ gl.bindTexture(gl.TEXTURE_2D, null);++ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);+ gl.framebufferTexture2D(+ gl.FRAMEBUFFER,+ gl.COLOR_ATTACHMENT0,+ gl.TEXTURE_2D,+ textureIntermediate,+ 0,+ );+ const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);+ if (status !== gl.FRAMEBUFFER_COMPLETE) {+ throw new Error(+ `Radial progressive blur framebuffer incomplete: 0x${status.toString(16)}`,+ );+ }++ return {+ gl,+ programHorizontal,+ programVertical,+ vao,+ vbo,+ textureSource,+ textureIntermediate,+ framebuffer,+ horizontal: getUniforms(gl, programHorizontal),+ vertical: getUniforms(gl, programVertical),+ };+};++export const cleanupRadialProgressiveBlur = (+ state: RadialProgressiveBlurState,+): void => {+ const {+ gl,+ programHorizontal,+ programVertical,+ vao,+ vbo,+ textureSource,+ textureIntermediate,+ framebuffer,+ } = state;+ gl.deleteFramebuffer(framebuffer);+ gl.deleteTexture(textureSource);+ gl.deleteTexture(textureIntermediate);+ gl.deleteBuffer(vbo);+ gl.deleteProgram(programHorizontal);+ gl.deleteProgram(programVertical);+ gl.deleteVertexArray(vao);+};++const uploadSource = ({+ gl,+ textureSource,+ textureIntermediate,+ source,+ width,+ height,+ flipSourceY,+}: {+ readonly gl: WebGL2RenderingContext;+ readonly textureSource: WebGLTexture;+ readonly textureIntermediate: WebGLTexture;+ readonly source: CanvasImageSource;+ readonly width: number;+ readonly height: number;+ readonly flipSourceY: boolean;+}): void => {+ 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, textureIntermediate);+ gl.texImage2D(+ gl.TEXTURE_2D,+ 0,+ gl.RGBA,+ width,+ height,+ 0,+ gl.RGBA,+ gl.UNSIGNED_BYTE,+ null,+ );+ gl.bindTexture(gl.TEXTURE_2D, null);+};++const setUniforms = ({+ gl,+ uniforms,+ width,+ height,+ params,+}: {+ readonly gl: WebGL2RenderingContext;+ readonly uniforms: RadialProgressiveBlurUniforms;+ readonly width: number;+ readonly height: number;+ readonly params: RadialProgressiveBlurResolved;+}): void => {+ if (uniforms.uSource) gl.uniform1i(uniforms.uSource, 0);+ if (uniforms.uTexelSize)+ gl.uniform2f(uniforms.uTexelSize, 1 / width, 1 / height);+ if (uniforms.uCenter)+ gl.uniform2f(uniforms.uCenter, params.center[0], params.center[1]);+ if (uniforms.uWidth) gl.uniform1f(uniforms.uWidth, params.width);+ if (uniforms.uHeight) gl.uniform1f(uniforms.uHeight, params.height);+ if (uniforms.uRotation) gl.uniform1f(uniforms.uRotation, params.rotation);+ if (uniforms.uStart) gl.uniform1f(uniforms.uStart, params.start);+ if (uniforms.uStartBlur) gl.uniform1f(uniforms.uStartBlur, params.startBlur);+ if (uniforms.uEndBlur) gl.uniform1f(uniforms.uEndBlur, params.endBlur);+};++const drawFullscreenQuad = (state: RadialProgressiveBlurState): void => {+ const {gl, vao} = state;+ gl.bindVertexArray(vao);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ gl.bindVertexArray(null);+};++export const applyRadialProgressiveBlur = ({+ state,+ source,+ width,+ height,+ params,+ flipSourceY,+}: {+ readonly state: RadialProgressiveBlurState;+ readonly source: CanvasImageSource;+ readonly width: number;+ readonly height: number;+ readonly params: RadialProgressiveBlurResolved;+ readonly flipSourceY: boolean;+}): void => {+ const {+ gl,+ programHorizontal,+ programVertical,+ textureSource,+ textureIntermediate,+ framebuffer,+ } = state;++ gl.viewport(0, 0, width, height);++ uploadSource({+ gl,+ textureSource,+ textureIntermediate,+ source,+ width,+ height,+ flipSourceY,+ });++ gl.clearColor(0, 0, 0, 0);++ gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);+ gl.clear(gl.COLOR_BUFFER_BIT);+ gl.activeTexture(gl.TEXTURE0);+ gl.bindTexture(gl.TEXTURE_2D, textureSource);+ gl.useProgram(programHorizontal);+ setUniforms({+ gl,+ uniforms: state.horizontal,+ width,+ height,+ params,+ });+ drawFullscreenQuad(state);++ gl.bindFramebuffer(gl.FRAMEBUFFER, null);+ gl.clear(gl.COLOR_BUFFER_BIT);+ gl.bindTexture(gl.TEXTURE_2D, textureIntermediate);+ gl.useProgram(programVertical);+ setUniforms({+ gl,+ uniforms: state.vertical,+ width,+ height,+ params,+ });+ drawFullscreenQuad(state);++ gl.bindTexture(gl.TEXTURE_2D, null);+ gl.useProgram(null);+};diff --git a/packages/effects/src/radial-progressive-blur/radial-progressive-blur-shaders.ts b/packages/effects/src/radial-progressive-blur/radial-progressive-blur-shaders.tsnew file mode 100644index 0000000000..742cf90eef--- /dev/null+++ b/packages/effects/src/radial-progressive-blur/radial-progressive-blur-shaders.ts@@ -0,0 +1,97 @@+export const RADIAL_PROGRESSIVE_BLUR_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 buildRadialProgressiveBlurFs = (+ direction: 'horizontal' | 'vertical',+) => {+ const dirVec =+ direction === 'horizontal' ? 'vec2(1.0, 0.0)' : 'vec2(0.0, 1.0)';++ return /* glsl */ `#version 300 es+precision highp float;++in vec2 vUv;+out vec4 fragColor;++uniform sampler2D uSource;+uniform vec2 uTexelSize;+uniform vec2 uCenter;+uniform float uWidth;+uniform float uHeight;+uniform float uRotation;+uniform float uStart;+uniform float uStartBlur;+uniform float uEndBlur;++const int MIN_KERNEL_HALF = 4;+const int MAX_KERNEL_HALF = 32;+const float TARGET_SAMPLE_DISTANCE_PX = 2.0;+const vec2 DIRECTION = ${dirVec};++float progressiveRadius(vec2 uv) {+ vec2 radii = vec2(uWidth / uTexelSize.x, uHeight / uTexelSize.y) * 0.5;++ if (radii.x <= 0.0000001 || radii.y <= 0.0000001) {+ return max(0.0, uStartBlur);+ }++ vec2 delta = (uv - uCenter) / uTexelSize;+ float angle = radians(uRotation);+ float c = cos(angle);+ float s = sin(angle);+ vec2 local = vec2(+ c * delta.x + s * delta.y,+ -s * delta.x + c * delta.y+ );+ float ellipseProgress = clamp(length(local / radii), 0.0, 1.0);+ float distance = 1.0 - uStart;+ float progress = abs(distance) <= 0.0000001+ ? step(uStart, ellipseProgress)+ : clamp((ellipseProgress - uStart) / distance, 0.0, 1.0);+ return max(0.0, mix(uStartBlur, uEndBlur, progress));+}++void main() {+ // Public UV coordinates use top-left origin, matching canvas/CSS coordinates.+ float radius = progressiveRadius(vec2(vUv.x, 1.0 - vUv.y));+ if (radius <= 0.0) {+ fragColor = texture(uSource, vUv);+ return;+ }++ int kernelHalf = int(+ min(+ float(MAX_KERNEL_HALF),+ max(float(MIN_KERNEL_HALF), ceil(radius / TARGET_SAMPLE_DISTANCE_PX))+ )+ );+ float pixelStride = radius / float(kernelHalf);+ float sigma = max(radius / 3.0, 0.0001);+ float twoSigmaSq = 2.0 * sigma * sigma;++ vec4 sum = vec4(0.0);+ float weightSum = 0.0;++ for (int i = -MAX_KERNEL_HALF; i <= MAX_KERNEL_HALF; ++i) {+ if (abs(i) > kernelHalf) {+ continue;+ }++ float offsetPx = float(i) * pixelStride;+ float w = exp(-(offsetPx * offsetPx) / twoSigmaSq);+ vec2 uv = vUv + DIRECTION * uTexelSize * offsetPx;+ sum += texture(uSource, uv) * w;+ weightSum += w;+ }++ fragColor = sum / weightSum;+}+`;+};diff --git a/packages/effects/src/test/effect-params.test.ts b/packages/effects/src/test/effect-params.test.tsindex af2fa6838e..02dad7226d 100644--- a/packages/effects/src/test/effect-params.test.ts+++ b/packages/effects/src/test/effect-params.test.ts@@ -34,6 +34,7 @@ import {noise} from '../noise.js';import {pattern} from '../pattern.js';import {pixelDissolve} from '../pixel-dissolve.js';import {pixelate} from '../pixelate.js';+import {radialProgressiveBlur} from '../radial-progressive-blur/index.js';import {rings} from '../rings.js';import {saturation} from '../saturation.js';import {scale} from '../scale.js';@@ -169,6 +170,9 @@ test('@remotion/effects expose documentation links', () => {expect(pattern().definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/pattern',);+ expect(radialProgressiveBlur().definition.documentationLink).toBe(+ 'https://www.remotion.dev/docs/effects/radial-progressive-blur',+ );expect(rings().definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/rings',);@@ -263,6 +267,9 @@ test('@remotion/effects expose API names as Studio labels', () => {noiseDisplacement({center: [0.5, 0.5], radius: 0.25}).definition.label,).toBe('noiseDisplacement()');expect(pattern().definition.label).toBe('pattern()');+ expect(radialProgressiveBlur().definition.label).toBe(+ 'radialProgressiveBlur()',+ );expect(rings().definition.label).toBe('rings()');expect(saturation().definition.label).toBe('saturation()');expect(scanlines().definition.label).toBe('scanlines()');@@ -1461,7 +1468,10 @@ test('halftoneLinearGradient() connects its stop position controls', () => {halftoneLinearGradient().definition.schema.firstStopPosition,).toMatchObject({type: 'uv-coordinate',- lineTo: 'secondStopPosition',+ visual: {+ type: 'line',+ to: 'secondStopPosition',+ },});});@@ -2557,7 +2567,10 @@ test('linearProgressiveBlur() accepts default params', () => {test('linearProgressiveBlur() connects its start and end controls', () => {expect(linearProgressiveBlur().definition.schema.start).toMatchObject({type: 'uv-coordinate',- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },});});@@ -2610,6 +2623,103 @@ test('linearProgressiveBlur() parameters produce distinct effect keys', () => {).toBe(5);});+test('radialProgressiveBlur() accepts default params', () => {+ expect(() => radialProgressiveBlur()).not.toThrow();+});++test('radialProgressiveBlur() connects its ellipse controls', () => {+ const {schema} = radialProgressiveBlur().definition;+ expect(schema.center).toMatchObject({+ type: 'uv-coordinate',+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ });+ expect(schema.width).toMatchObject({type: 'number'});+ expect(schema.height).toMatchObject({type: 'number'});+ expect(schema.rotation).toMatchObject({type: 'rotation-degrees'});+ expect(schema.width).not.toHaveProperty('max');+ expect(schema.height).not.toHaveProperty('max');+});++test('radialProgressiveBlur() rejects invalid ellipse params', () => {+ expect(() =>+ radialProgressiveBlur({+ center: [0.5] as unknown as [number, number],+ }),+ ).toThrow('"center" must be a [number, number] tuple');+ expect(() => radialProgressiveBlur({width: Number.NaN})).toThrow(+ '"width" must be a finite number',+ );+ expect(() => radialProgressiveBlur({height: Number.NaN})).toThrow(+ '"height" must be a finite number',+ );+ expect(() => radialProgressiveBlur({rotation: Number.NaN})).toThrow(+ '"rotation" must be a finite number',+ );+ expect(() => radialProgressiveBlur({width: -0.1})).toThrow(+ '"width" must be >= 0',+ );+ expect(() => radialProgressiveBlur({height: -0.1})).toThrow(+ '"height" must be >= 0',+ );+});++test('radialProgressiveBlur() rejects non-finite blur radii', () => {+ expect(() => radialProgressiveBlur({start: Number.NaN})).toThrow(+ '"start" must be a finite number',+ );+ expect(() => radialProgressiveBlur({startBlur: Number.NaN})).toThrow(+ '"startBlur" must be a finite number',+ );+ expect(() => radialProgressiveBlur({endBlur: Number.NaN})).toThrow(+ '"endBlur" must be a finite number',+ );+});++test('radialProgressiveBlur() rejects progress outside the unit interval', () => {+ expect(() => radialProgressiveBlur({start: -0.1})).toThrow(+ '"start" must be >= 0',+ );+ expect(() => radialProgressiveBlur({start: 1.1})).toThrow(+ '"start" must be <= 1',+ );+});++test('radialProgressiveBlur() clamps negative blur radii', () => {+ const clamped = radialProgressiveBlur({startBlur: -10, endBlur: -1});+ const zero = radialProgressiveBlur({startBlur: 0, endBlur: 0});+ expect(clamped.effectKey).toBe(zero.effectKey);+});++test('radialProgressiveBlur() parameters produce distinct effect keys', () => {+ const defaults = radialProgressiveBlur();+ const shiftedCenter = radialProgressiveBlur({center: [0.4, 0.5]});+ const wider = radialProgressiveBlur({width: 1.2});+ const taller = radialProgressiveBlur({height: 1.2});+ const rotated = radialProgressiveBlur({rotation: 15});+ const shiftedStart = radialProgressiveBlur({start: 0.2});+ const moreStartBlur = radialProgressiveBlur({startBlur: 12});+ const moreEndBlur = radialProgressiveBlur({endBlur: 80});++ expect(+ new Set([+ defaults.effectKey,+ shiftedCenter.effectKey,+ wider.effectKey,+ taller.effectKey,+ rotated.effectKey,+ shiftedStart.effectKey,+ moreStartBlur.effectKey,+ moreEndBlur.effectKey,+ ]).size,+ ).toBe(8);+});+test('zoomBlur() accepts default params', () => {expect(() => zoomBlur()).not.toThrow();});diff --git a/packages/example/src/EffectsTestbed/RadialProgressiveBlur.tsx b/packages/example/src/EffectsTestbed/RadialProgressiveBlur.tsxnew file mode 100644index 0000000000..fde608f078--- /dev/null+++ b/packages/example/src/EffectsTestbed/RadialProgressiveBlur.tsx@@ -0,0 +1,33 @@+import {radialProgressiveBlur} from '@remotion/effects/radial-progressive-blur';+import React from 'react';+import {AbsoluteFill, CanvasImage, staticFile, useVideoConfig} from 'remotion';++const page: React.CSSProperties = {+ backgroundColor: '#10141d',+};++export const RadialProgressiveBlurTest: React.FC = () => {+ const {width, height} = useVideoConfig();++ return (+ <AbsoluteFill style={page}>+ <CanvasImage+ src={staticFile('1.jpg')}+ width={width}+ height={height}+ fit="cover"+ effects={[+ radialProgressiveBlur({+ center: [0.568, 0.383],+ width: 1.62,+ height: 1.892,+ rotation: 1968.6,+ start: 0.39,+ startBlur: 0,+ endBlur: 178,+ }),+ ]}+ />+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex 7f0c8ddfa5..2abd11f404 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -198,6 +198,7 @@ import {EffectsTestbed} from './EffectsTestbed/EffectsTestbed';import {HalftoneGradient} from './EffectsTestbed/HalftoneGradient';import {NoiseDisplacementText} from './EffectsTestbed/NoiseDisplacementText';import {PaletteMapEffect} from './EffectsTestbed/PaletteMapEffect';+import {RadialProgressiveBlurTest} from './EffectsTestbed/RadialProgressiveBlur';import {VideoEffectsFastRefresh} from './EffectsTestbed/VideoEffectsFastRefresh';import {Empty} from './Empty';import {JumpCuts, SAMPLE_SECTIONS, calculateMetadataJumpCuts} from './JumpCuts';@@ -2017,6 +2018,14 @@ export const Index: React.FC = () => {fps={30}durationInFrames={150}/>+ <Composition+ id="radial-progressive-blur-test"+ component={RadialProgressiveBlurTest}+ width={1920}+ height={1080}+ fps={30}+ durationInFrames={120}+ /><Compositionid="custom-effects-sample"component={CustomEffectsSample}diff --git a/packages/skills/skills/remotion/SKILL.md b/packages/skills/skills/remotion/SKILL.mdindex 28eb6f31a9..d190be737c 100644--- a/packages/skills/skills/remotion/SKILL.md+++ b/packages/skills/skills/remotion/SKILL.md@@ -260,7 +260,7 @@ When creating a visual effect, prefer: 1. normal Remotion/HTML/CSS/SVG/filter/blFor light leak overlays, see [rules/light-leaks.md](rules/light-leaks.md). Docs: https://www.remotion.dev/docs/effects-Available effects: `brightness()`, `contrast()`, `colorKey()`, `duotone()`, `grayscale()`, `hue()`, `invert()`, `saturation()`, `tint()`, `thermalVision()`, `blur()`, `linearProgressiveBlur()`, `zoomBlur()`, `dropShadow()`, `glow()`, `lightTrail()`, `evolve()`, `mirror()`, `scale()`, `uvTranslate()`, `xyTranslate()`, `barrelDistortion()`, `chromaticAberration()`, `fisheye()`, `cornerPin()`, `wave()`, `burlap()`, `emboss()`, `dotGrid()`, `halftone()`, `noise()`, `noiseDisplacement()`, `pattern()`, `pixelate()`, `pixelDissolve()`, `scanlines()`, `speckle()`, `shine()`, `shrinkwrap()`, `vignette()`, `contourLines()`, `checkerboard()`, `halftoneLinearGradient()`, `gridlines()`, `whiteNoise()`, `tvSignalOff()`, `lines()`, `rings()`, `waves()`, `zigzag()`, `lightLeak()`, `starburst()`.+Available effects: `brightness()`, `contrast()`, `colorKey()`, `duotone()`, `grayscale()`, `hue()`, `invert()`, `saturation()`, `tint()`, `thermalVision()`, `blur()`, `linearProgressiveBlur()`, `radialProgressiveBlur()`, `zoomBlur()`, `dropShadow()`, `glow()`, `lightTrail()`, `evolve()`, `mirror()`, `scale()`, `uvTranslate()`, `xyTranslate()`, `barrelDistortion()`, `chromaticAberration()`, `fisheye()`, `cornerPin()`, `wave()`, `burlap()`, `emboss()`, `dotGrid()`, `halftone()`, `noise()`, `noiseDisplacement()`, `pattern()`, `pixelate()`, `pixelDissolve()`, `scanlines()`, `speckle()`, `shine()`, `shrinkwrap()`, `vignette()`, `contourLines()`, `checkerboard()`, `halftoneLinearGradient()`, `gridlines()`, `whiteNoise()`, `tvSignalOff()`, `lines()`, `rings()`, `waves()`, `zigzag()`, `lightLeak()`, `starburst()`.## 3D contentdiff --git a/packages/studio-shared/src/effect-catalog.ts b/packages/studio-shared/src/effect-catalog.tsindex b932f85db3..72efefe6af 100644--- a/packages/studio-shared/src/effect-catalog.ts+++ b/packages/studio-shared/src/effect-catalog.ts@@ -217,6 +217,17 @@ export const EFFECT_CATALOG: readonly EffectCatalogItem[] = [config: {},},},+ {+ id: 'effects-radial-progressive-blur',+ category: 'Blur & Shadow',+ label: 'radialProgressiveBlur()',+ description: 'Ellipse-controlled blur effect',+ effect: {+ name: 'radialProgressiveBlur',+ importPath: '@remotion/effects/radial-progressive-blur',+ config: {},+ },+ },{id: 'effects-zoom-blur',category: 'Blur & Shadow',diff --git a/packages/studio/src/components/SelectedOutlineUvControls.tsx b/packages/studio/src/components/SelectedOutlineUvControls.tsxindex 0277a72680..ab40c8a0f7 100644--- a/packages/studio/src/components/SelectedOutlineUvControls.tsx+++ b/packages/studio/src/components/SelectedOutlineUvControls.tsx@@ -9,17 +9,29 @@ import {import {isSelectedOutlineDragPastThreshold,snapSelectedOutlineUv,+ selectedOutlineRotationSnapStepDegrees,} from './selected-outline-drag';import type {OutlinePoint, SelectedOutline} from './selected-outline-geometry';import {getOutlineSelectionInteraction} from './selected-outline-measurement';+import {+ getAngleDegrees,+ getRotationCursor,+ getSelectedOutlineRotationDeltaDegrees,+} from './selected-outline-measurement';import {constrainUv,+ getUvEllipseInteractiveControls,+ getUvHandleConnectionEllipses,getUvCoordinateForPoint,getUvHandleConnectionLines,getUvHandlePosition,+ roundNumericUvEllipseValue,roundUvCoordinate,tuplesEqual,type SelectedOutlineUvHandle,+ type UvEllipseInteractiveControls,+ type UvEllipseResizeAxis,+ type UvEllipseControlField,type UvCoordinate,} from './selected-outline-uv';import {callAddEffectKeyframe} from './Timeline/call-add-keyframe';@@ -44,6 +56,7 @@ const getSvgPointFromPointerEvent = ({const uvHandleRadius = 4.25;const selectedUvHandleRadius = 6.8;+const ellipseControlRadius = 5.2;const uvHandleStyle: React.CSSProperties = {filter: 'drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28))',};@@ -76,9 +89,31 @@ const SelectedUvHandleConnectionLines: React.FC<{() => getUvHandleConnectionLines({handles, points: outline.points}),[handles, outline.points],);+ const ellipses = useMemo(+ () =>+ getUvHandleConnectionEllipses({+ handles,+ dimensions: outline.dimensions,+ points: outline.points,+ }),+ [handles, outline.dimensions, outline.points],+ );return (<>+ {ellipses.map((ellipse) => (+ <polyline+ key={ellipse.key}+ points={ellipse.points+ .map((point) => `${point.x},${point.y}`)+ .join(' ')}+ fill="none"+ stroke={BLUE}+ strokeWidth={2}+ vectorEffect="non-scaling-stroke"+ pointerEvents="none"+ />+ ))}{lines.map((line) => (<linekey={line.key}@@ -96,6 +131,694 @@ const SelectedUvHandleConnectionLines: React.FC<{);};+const fieldDefaultToString = (value: unknown): string | null =>+ value !== undefined ? JSON.stringify(value) : null;++const shouldSaveNumericEffectValue = ({+ defaultValue,+ field,+ value,+}: {+ readonly defaultValue: string | null;+ readonly field: UvEllipseControlField;+ readonly value: number | null;+}): boolean => {+ if (value === null) {+ return false;+ }++ if (field.propStatus.status === 'keyframed') {+ return field.value !== value;+ }++ const stringifiedValue = JSON.stringify(value);+ return (+ field.propStatus.codeValue !== value &&+ !(+ defaultValue === stringifiedValue &&+ field.propStatus.codeValue === undefined+ )+ );+};++const saveNumericEffectField = ({+ clearEffectDragOverrides,+ clientId,+ effectIndex,+ field,+ lastValue,+ nodePath,+ schema,+ setPropStatuses,+ sourceFrame,+}: {+ readonly clearEffectDragOverrides: React.ContextType<+ typeof Internals.VisualModeSettersContext+ >['clearEffectDragOverrides'];+ readonly clientId: string;+ readonly effectIndex: number;+ readonly field: UvEllipseControlField;+ readonly lastValue: number | null;+ readonly nodePath: SelectedOutlineUvHandle['nodePath'];+ readonly schema: SelectedOutlineUvHandle['schema'];+ readonly setPropStatuses: React.ContextType<+ typeof Internals.VisualModeSettersContext+ >['setPropStatuses'];+ readonly sourceFrame: number;+}): void => {+ const defaultValue = fieldDefaultToString(field.fieldDefault);+ if (+ !shouldSaveNumericEffectValue({+ defaultValue,+ field,+ value: lastValue,+ })+ ) {+ clearEffectDragOverrides(nodePath, effectIndex);+ return;+ }++ (field.propStatus.status === 'keyframed'+ ? callAddEffectKeyframe({+ fileName: nodePath.absolutePath,+ nodePath,+ effectIndex,+ fieldKey: field.fieldKey,+ sourceFrame,+ value: lastValue,+ schema,+ setPropStatuses,+ clientId,+ })+ : saveEffectProp({+ type: 'value',+ fileName: nodePath.absolutePath,+ nodePath,+ effectIndex,+ fieldKey: field.fieldKey,+ value: lastValue,+ defaultValue,+ schema,+ setPropStatuses,+ clientId,+ })+ ).finally(() => {+ clearEffectDragOverrides(nodePath, effectIndex);+ });+};++const getLocalEllipseAxisValue = ({+ axis,+ center,+ dimensions,+ point,+ rotation,+}: {+ readonly axis: UvEllipseResizeAxis;+ readonly center: UvCoordinate;+ readonly dimensions: SelectedOutline['dimensions'];+ readonly point: UvCoordinate;+ readonly rotation: number;+}): number => {+ const radians = (rotation / 180) * Math.PI;+ const deltaX = point[0] - center[0];+ const deltaY = point[1] - center[1];+ const axisX = axis === 'width' ? Math.cos(radians) : -Math.sin(radians);+ const axisY = axis === 'width' ? Math.sin(radians) : Math.cos(radians);++ if (dimensions !== null && dimensions.width > 0 && dimensions.height > 0) {+ const pixelDeltaX = deltaX * dimensions.width;+ const pixelDeltaY = deltaY * dimensions.height;+ const pixelAxisValue = pixelDeltaX * axisX + pixelDeltaY * axisY;++ return (+ pixelAxisValue / (axis === 'width' ? dimensions.width : dimensions.height)+ );+ }++ return deltaX * axisX + deltaY * axisY;+};++const getLocalEllipseWidthProgress = ({+ center,+ dimensions,+ point,+ rotation,+ width,+}: {+ readonly center: UvCoordinate;+ readonly dimensions: SelectedOutline['dimensions'];+ readonly point: UvCoordinate;+ readonly rotation: number;+ readonly width: number;+}): number => {+ if (width <= 0.000001) {+ return 0;+ }++ return (+ getLocalEllipseAxisValue({+ axis: 'width',+ center,+ dimensions,+ point,+ rotation,+ }) /+ (width / 2)+ );+};++const SelectedUvEllipseStartHandle: React.FC<{+ readonly control: UvEllipseInteractiveControls;+ readonly onDraggingChange: (dragging: boolean) => void;+ readonly outline: SelectedOutline;+}> = ({control, onDraggingChange, outline}) => {+ const {setEffectDragOverrides, clearEffectDragOverrides, setPropStatuses} =+ useContext(Internals.VisualModeSettersContext);+ const {startControl} = control;+ const field = startControl?.field;++ const onPointerDown = React.useCallback(+ (event: React.PointerEvent<SVGCircleElement>) => {+ if (startControl === null || field === undefined) {+ return;+ }++ if (event.button !== 0) {+ return;+ }++ event.preventDefault();+ event.stopPropagation();++ const svg = event.currentTarget.ownerSVGElement;+ if (svg === null) {+ return;+ }++ const svgRect = svg.getBoundingClientRect();+ const startPointerX = event.clientX;+ const startPointerY = event.clientY;+ let dragging = false;+ let lastValue: number | null = null;++ const updateFromPointerEvent = (pointerEvent: PointerEvent) => {+ const point = getSvgPointFromPointerEvent({+ event: pointerEvent,+ rect: svgRect,+ });+ const uv = getUvCoordinateForPoint(outline.points, point);+ const nextValue = roundNumericUvEllipseValue(+ getLocalEllipseWidthProgress({+ center: control.handle.value,+ dimensions: outline.dimensions,+ point: uv,+ rotation: control.rotation,+ width: control.width,+ }),+ field.fieldSchema,+ );+ lastValue = nextValue;+ setEffectDragOverrides(+ control.handle.nodePath,+ control.handle.effectIndex,+ field.fieldKey,+ field.propStatus.status === 'keyframed'+ ? Internals.makeKeyframedDragOverride({+ status: field.propStatus,+ frame: control.handle.sourceFrame,+ value: nextValue,+ })+ : Internals.makeStaticDragOverride(nextValue),+ );+ };++ const onPointerMove = (moveEvent: PointerEvent) => {+ moveEvent.preventDefault();+ const deltaX = moveEvent.clientX - startPointerX;+ const deltaY = moveEvent.clientY - startPointerY;+ if (!dragging) {+ if (!isSelectedOutlineDragPastThreshold({deltaX, deltaY})) {+ return;+ }++ dragging = true;+ forceSpecificCursor(startControl.cursor);+ onDraggingChange(true);+ }++ updateFromPointerEvent(moveEvent);+ };++ const onPointerUp = () => {+ window.removeEventListener('pointermove', onPointerMove);+ window.removeEventListener('pointerup', onPointerUp);+ window.removeEventListener('pointercancel', onPointerUp);+ if (dragging) {+ stopForcingSpecificCursor();+ onDraggingChange(false);+ }++ saveNumericEffectField({+ clearEffectDragOverrides,+ clientId: control.handle.clientId,+ effectIndex: control.handle.effectIndex,+ field,+ lastValue,+ nodePath: control.handle.nodePath,+ schema: control.handle.schema,+ setPropStatuses,+ sourceFrame: control.handle.sourceFrame,+ });+ };++ window.addEventListener('pointermove', onPointerMove);+ window.addEventListener('pointerup', onPointerUp);+ window.addEventListener('pointercancel', onPointerUp);+ },+ [+ clearEffectDragOverrides,+ control.handle,+ control.rotation,+ control.width,+ field,+ onDraggingChange,+ outline.dimensions,+ outline.points,+ setEffectDragOverrides,+ setPropStatuses,+ startControl,+ ],+ );++ if (startControl === null || field === undefined) {+ return null;+ }++ return (+ <circle+ cx={startControl.position.x}+ cy={startControl.position.y}+ r={ellipseControlRadius}+ fill="white"+ stroke={BLUE}+ strokeWidth={2}+ style={uvHandleStyle}+ vectorEffect="non-scaling-stroke"+ pointerEvents="all"+ cursor={startControl.cursor}+ onPointerDown={onPointerDown}+ />+ );+};++const SelectedUvEllipseResizeHandle: React.FC<{+ readonly control: UvEllipseInteractiveControls;+ readonly axis: UvEllipseResizeAxis;+ readonly onDraggingChange: (dragging: boolean) => void;+ readonly outline: SelectedOutline;+}> = ({axis, control, onDraggingChange, outline}) => {+ const {setEffectDragOverrides, clearEffectDragOverrides, setPropStatuses} =+ useContext(Internals.VisualModeSettersContext);+ const resizeControl = control.resize.find((item) => item.axis === axis);+ const field = resizeControl?.field;++ const onPointerDown = React.useCallback(+ (event: React.PointerEvent<SVGCircleElement>) => {+ if (resizeControl === undefined || field === undefined) {+ return;+ }++ if (event.button !== 0) {+ return;+ }++ event.preventDefault();+ event.stopPropagation();++ const svg = event.currentTarget.ownerSVGElement;+ if (svg === null) {+ return;+ }++ const svgRect = svg.getBoundingClientRect();+ const startPointerX = event.clientX;+ const startPointerY = event.clientY;+ let dragging = false;+ let lastValue: number | null = null;++ const updateFromPointerEvent = (pointerEvent: PointerEvent) => {+ const point = getSvgPointFromPointerEvent({+ event: pointerEvent,+ rect: svgRect,+ });+ const uv = getUvCoordinateForPoint(outline.points, point);+ const axisValue = getLocalEllipseAxisValue({+ axis,+ center: control.handle.value,+ dimensions: outline.dimensions,+ point: uv,+ rotation: control.rotation,+ });+ const nextValue = roundNumericUvEllipseValue(+ Math.max(0, axisValue * 2),+ field.fieldSchema,+ );+ lastValue = nextValue;+ setEffectDragOverrides(+ control.handle.nodePath,+ control.handle.effectIndex,+ field.fieldKey,+ field.propStatus.status === 'keyframed'+ ? Internals.makeKeyframedDragOverride({+ status: field.propStatus,+ frame: control.handle.sourceFrame,+ value: nextValue,+ })+ : Internals.makeStaticDragOverride(nextValue),+ );+ };++ const onPointerMove = (moveEvent: PointerEvent) => {+ moveEvent.preventDefault();+ const deltaX = moveEvent.clientX - startPointerX;+ const deltaY = moveEvent.clientY - startPointerY;+ if (!dragging) {+ if (!isSelectedOutlineDragPastThreshold({deltaX, deltaY})) {+ return;+ }++ dragging = true;+ forceSpecificCursor(resizeControl.cursor);+ onDraggingChange(true);+ }++ updateFromPointerEvent(moveEvent);+ };++ const onPointerUp = () => {+ window.removeEventListener('pointermove', onPointerMove);+ window.removeEventListener('pointerup', onPointerUp);+ window.removeEventListener('pointercancel', onPointerUp);+ if (dragging) {+ stopForcingSpecificCursor();+ onDraggingChange(false);+ }++ saveNumericEffectField({+ clearEffectDragOverrides,+ clientId: control.handle.clientId,+ effectIndex: control.handle.effectIndex,+ field,+ lastValue,+ nodePath: control.handle.nodePath,+ schema: control.handle.schema,+ setPropStatuses,+ sourceFrame: control.handle.sourceFrame,+ });+ };++ window.addEventListener('pointermove', onPointerMove);+ window.addEventListener('pointerup', onPointerUp);+ window.addEventListener('pointercancel', onPointerUp);+ },+ [+ axis,+ clearEffectDragOverrides,+ control.handle,+ control.rotation,+ field,+ onDraggingChange,+ outline.dimensions,+ outline.points,+ resizeControl,+ setEffectDragOverrides,+ setPropStatuses,+ ],+ );++ if (resizeControl === undefined || field === undefined) {+ return null;+ }++ return (+ <circle+ cx={resizeControl.position.x}+ cy={resizeControl.position.y}+ r={ellipseControlRadius}+ fill="white"+ stroke={BLUE}+ strokeWidth={2}+ style={uvHandleStyle}+ vectorEffect="non-scaling-stroke"+ pointerEvents="all"+ cursor={resizeControl.cursor}+ onPointerDown={onPointerDown}+ />+ );+};++const snapRotationDegrees = (value: number): number =>+ Math.round(value / selectedOutlineRotationSnapStepDegrees) *+ selectedOutlineRotationSnapStepDegrees;++const trimLineToCircleEdges = ({+ from,+ fromRadius,+ to,+ toRadius,+}: {+ readonly from: OutlinePoint;+ readonly fromRadius: number;+ readonly to: OutlinePoint;+ readonly toRadius: number;+}): {readonly from: OutlinePoint; readonly to: OutlinePoint} => {+ const deltaX = to.x - from.x;+ const deltaY = to.y - from.y;+ const distance = Math.hypot(deltaX, deltaY);+ if (distance <= fromRadius + toRadius || distance <= 0.000001) {+ const middle = {+ x: (from.x + to.x) / 2,+ y: (from.y + to.y) / 2,+ };+ return {from: middle, to: middle};+ }++ const unitX = deltaX / distance;+ const unitY = deltaY / distance;+ return {+ from: {+ x: from.x + unitX * fromRadius,+ y: from.y + unitY * fromRadius,+ },+ to: {+ x: to.x - unitX * toRadius,+ y: to.y - unitY * toRadius,+ },+ };+};++const SelectedUvEllipseRotationHandle: React.FC<{+ readonly control: UvEllipseInteractiveControls;+ readonly onDraggingChange: (dragging: boolean) => void;+}> = ({control, onDraggingChange}) => {+ const {setEffectDragOverrides, clearEffectDragOverrides, setPropStatuses} =+ useContext(Internals.VisualModeSettersContext);+ const {rotationControl} = control;+ const field = rotationControl?.field;++ const onPointerDown = React.useCallback(+ (event: React.PointerEvent<SVGCircleElement>) => {+ if (rotationControl === null || field === undefined) {+ return;+ }++ if (event.button !== 0) {+ return;+ }++ event.preventDefault();+ event.stopPropagation();++ const svg = event.currentTarget.ownerSVGElement;+ if (svg === null) {+ return;+ }++ const svgRect = svg.getBoundingClientRect();+ const {center} = control;+ const startPointer = {x: event.clientX, y: event.clientY};+ let previousAngle = getAngleDegrees(center, {+ x: event.clientX - svgRect.left,+ y: event.clientY - svgRect.top,+ });+ const startCursorDegrees = previousAngle;+ let accumulatedDelta = 0;+ let rotationLocked = event.shiftKey;+ let dragging = false;+ let lastValue: number | null = null;++ const updateRotationDragOverride = () => {+ const rawValue = control.rotation + accumulatedDelta;+ const snappedValue = rotationLocked+ ? snapRotationDegrees(rawValue)+ : rawValue;+ const nextValue = roundNumericUvEllipseValue(+ snappedValue,+ field.fieldSchema,+ );+ const cursorDelta = getSelectedOutlineRotationDeltaDegrees({+ from: control.rotation,+ to: nextValue,+ });+ lastValue = nextValue;+ forceSpecificCursor(+ getRotationCursor(startCursorDegrees + cursorDelta),+ );+ setEffectDragOverrides(+ control.handle.nodePath,+ control.handle.effectIndex,+ field.fieldKey,+ field.propStatus.status === 'keyframed'+ ? Internals.makeKeyframedDragOverride({+ status: field.propStatus,+ frame: control.handle.sourceFrame,+ value: nextValue,+ })+ : Internals.makeStaticDragOverride(nextValue),+ );+ };++ const onPointerMove = (moveEvent: PointerEvent) => {+ moveEvent.preventDefault();+ const deltaX = moveEvent.clientX - startPointer.x;+ const deltaY = moveEvent.clientY - startPointer.y;+ if (!dragging) {+ if (!isSelectedOutlineDragPastThreshold({deltaX, deltaY})) {+ return;+ }++ dragging = true;+ onDraggingChange(true);+ }++ const nextAngle = getAngleDegrees(center, {+ x: moveEvent.clientX - svgRect.left,+ y: moveEvent.clientY - svgRect.top,+ });+ accumulatedDelta += getSelectedOutlineRotationDeltaDegrees({+ from: previousAngle,+ to: nextAngle,+ });+ previousAngle = nextAngle;+ rotationLocked = moveEvent.shiftKey;+ updateRotationDragOverride();+ };++ const onKeyChange = (keyEvent: KeyboardEvent) => {+ if (keyEvent.key !== 'Shift') {+ return;+ }++ const nextRotationLocked = keyEvent.type === 'keydown';+ if (nextRotationLocked === rotationLocked) {+ return;+ }++ rotationLocked = nextRotationLocked;+ if (dragging) {+ updateRotationDragOverride();+ }+ };++ const onPointerUp = () => {+ window.removeEventListener('pointermove', onPointerMove);+ window.removeEventListener('pointerup', onPointerUp);+ window.removeEventListener('pointercancel', onPointerUp);+ window.removeEventListener('keydown', onKeyChange);+ window.removeEventListener('keyup', onKeyChange);+ if (dragging) {+ stopForcingSpecificCursor();+ onDraggingChange(false);+ }++ saveNumericEffectField({+ clearEffectDragOverrides,+ clientId: control.handle.clientId,+ effectIndex: control.handle.effectIndex,+ field,+ lastValue,+ nodePath: control.handle.nodePath,+ schema: control.handle.schema,+ setPropStatuses,+ sourceFrame: control.handle.sourceFrame,+ });+ };++ window.addEventListener('pointermove', onPointerMove);+ window.addEventListener('pointerup', onPointerUp);+ window.addEventListener('pointercancel', onPointerUp);+ window.addEventListener('keydown', onKeyChange);+ window.addEventListener('keyup', onKeyChange);+ },+ [+ clearEffectDragOverrides,+ control,+ field,+ onDraggingChange,+ rotationControl,+ setEffectDragOverrides,+ setPropStatuses,+ ],+ );++ if (rotationControl === null || field === undefined) {+ return null;+ }++ const heightControl = control.resize.find((item) => item.axis === 'height');+ if (heightControl === undefined) {+ return null;+ }++ const connector = trimLineToCircleEdges({+ from: heightControl.position,+ fromRadius: ellipseControlRadius,+ to: rotationControl.position,+ toRadius: ellipseControlRadius,+ });++ return (+ <>+ <line+ x1={connector.from.x}+ y1={connector.from.y}+ x2={connector.to.x}+ y2={connector.to.y}+ stroke={BLUE}+ strokeWidth={2}+ vectorEffect="non-scaling-stroke"+ pointerEvents="none"+ />+ <circle+ cx={rotationControl.position.x}+ cy={rotationControl.position.y}+ r={ellipseControlRadius}+ fill="white"+ stroke={BLUE}+ strokeWidth={2}+ style={uvHandleStyle}+ vectorEffect="non-scaling-stroke"+ pointerEvents="all"+ cursor={getRotationCursor(+ getAngleDegrees(control.center, rotationControl.position),+ )}+ onPointerDown={onPointerDown}+ />+ </>+ );+};+const SelectedUvHandleCircle: React.FC<{readonly onDraggingChange: (dragging: boolean) => void;readonly onSelect: (@@ -331,12 +1054,49 @@ export const SelectedOutlineUvHandleCircleLayer: React.FC<{readonly outline: SelectedOutline;readonly target: UvTarget | undefined;}> = ({onDraggingChange, onSelect, outline, target}) => {+ const ellipseControls = useMemo(+ () =>+ getUvEllipseInteractiveControls({+ handles: target?.uvHandles ?? [],+ dimensions: outline.dimensions,+ points: outline.points,+ }),+ [outline.dimensions, outline.points, target?.uvHandles],+ );+if (!target?.containsSelection || target.uvHandles.length === 0) {return null;}return (<>+ {ellipseControls.map((control) => (+ <React.Fragment+ key={`${control.handle.effectIndex}-${control.handle.fieldKey}-ellipse-controls`}+ >+ <SelectedUvEllipseStartHandle+ control={control}+ onDraggingChange={onDraggingChange}+ outline={outline}+ />+ <SelectedUvEllipseResizeHandle+ axis="width"+ control={control}+ onDraggingChange={onDraggingChange}+ outline={outline}+ />+ <SelectedUvEllipseResizeHandle+ axis="height"+ control={control}+ onDraggingChange={onDraggingChange}+ outline={outline}+ />+ <SelectedUvEllipseRotationHandle+ control={control}+ onDraggingChange={onDraggingChange}+ />+ </React.Fragment>+ ))}{target.uvHandles.map((handle) => (<SelectedUvHandleCirclekey={`${handle.effectIndex}-${handle.fieldKey}`}diff --git a/packages/studio/src/components/selected-outline-uv.ts b/packages/studio/src/components/selected-outline-uv.tsindex 47a7e7e45f..64a6dabc4b 100644--- a/packages/studio/src/components/selected-outline-uv.ts+++ b/packages/studio/src/components/selected-outline-uv.ts@@ -23,17 +23,46 @@ import {export type UvCoordinate = readonly [number, number];+type UvEllipseDimensions = {+ readonly width: number;+ readonly height: number;+};+export type UvCoordinateFieldSchema = Extract<InteractivitySchemaField,{type: 'uv-coordinate'}>;+export type NumericUvEllipseFieldSchema = Extract<+ InteractivitySchemaField,+ {type: 'number' | 'rotation-degrees'}+>;++export type UvEllipseControlField = {+ readonly fieldKey: string;+ readonly fieldSchema: NumericUvEllipseFieldSchema;+ readonly fieldDefault: number | null | undefined;+ readonly propStatus:+ | CanUpdateSequencePropStatusStatic+ | CanUpdateSequencePropStatusKeyframed;+ readonly value: number;+};++export type UvEllipseControls = {+ readonly width: UvEllipseControlField;+ readonly height: UvEllipseControlField;+ readonly rotation: UvEllipseControlField | null;+ readonly innerScale: UvEllipseControlField | null;+};+export type SelectedOutlineUvHandle = {readonly clientId: string;readonly propStatus:| CanUpdateSequencePropStatusStatic| CanUpdateSequencePropStatusKeyframed;readonly effectIndex: number;+ readonly effectValues: Record<string, unknown>;+ readonly ellipseControls: UvEllipseControls | null;readonly fieldDefault: UvCoordinate | undefined;readonly fieldKey: string;readonly fieldSchema: UvCoordinateFieldSchema;@@ -47,7 +76,10 @@ export type SelectedOutlineUvHandle = {type UvConnectionHandle = Pick<SelectedOutlineUvHandle,'effectIndex' | 'fieldKey' | 'fieldSchema' | 'value'->;+> & {+ readonly effectValues?: Record<string, unknown>;+ readonly ellipseControls?: UvEllipseControls | null;+};type UvHandleConnectionLine = {readonly key: string;@@ -55,6 +87,46 @@ type UvHandleConnectionLine = {readonly to: OutlinePoint;};+type UvHandleConnectionEllipse = {+ readonly key: string;+ readonly points: readonly OutlinePoint[];+};++export type UvEllipseResizeAxis = 'width' | 'height';++export type UvEllipseResizeControl = {+ readonly key: string;+ readonly axis: UvEllipseResizeAxis;+ readonly field: UvEllipseControlField;+ readonly position: OutlinePoint;+ readonly cursor: string;+};++export type UvEllipseRotationControl = {+ readonly key: string;+ readonly field: UvEllipseControlField;+ readonly position: OutlinePoint;+ readonly cursor: string;+};++export type UvEllipseStartControl = {+ readonly key: string;+ readonly field: UvEllipseControlField;+ readonly position: OutlinePoint;+ readonly cursor: string;+};++export type UvEllipseInteractiveControls = {+ readonly handle: SelectedOutlineUvHandle;+ readonly center: OutlinePoint;+ readonly width: number;+ readonly height: number;+ readonly rotation: number;+ readonly resize: readonly UvEllipseResizeControl[];+ readonly rotationControl: UvEllipseRotationControl | null;+ readonly startControl: UvEllipseStartControl | null;+};+type SelectedEffectFields = {readonly allFields: boolean;readonly fieldKeys: ReadonlySet<string>;@@ -72,6 +144,124 @@ const parseUvCoordinate = (value: unknown): UvCoordinate | null => {return null;};+const parseFiniteNumber = (value: unknown): number | null => {+ if (typeof value === 'number' && Number.isFinite(value)) {+ return value;+ }++ return null;+};++const getResizeCursor = (degrees: number): string => {+ const normalizedDegrees = ((degrees % 180) + 180) % 180;+ const snappedDegrees = Math.round(normalizedDegrees / 45) * 45;++ if (snappedDegrees === 0 || snappedDegrees === 180) {+ return 'ew-resize';+ }++ if (snappedDegrees === 45) {+ return 'nwse-resize';+ }++ if (snappedDegrees === 90) {+ return 'ns-resize';+ }++ return 'nesw-resize';+};++const getRotatedEllipseUv = ({+ center,+ dimensions,+ width,+ height,+ rotation,+ angle,+ radiusOffset = 0,+}: {+ readonly center: UvCoordinate;+ readonly dimensions?: UvEllipseDimensions | null;+ readonly width: number;+ readonly height: number;+ readonly rotation: number;+ readonly angle: number;+ readonly radiusOffset?: number;+}): UvCoordinate => {+ const rotationRadians = (rotation / 180) * Math.PI;+ const cosRotation = Math.cos(rotationRadians);+ const sinRotation = Math.sin(rotationRadians);++ if (+ dimensions !== null &&+ dimensions !== undefined &&+ dimensions.width > 0 &&+ dimensions.height > 0+ ) {+ const radiusX =+ width * dimensions.width * 0.5 + radiusOffset * dimensions.width;+ const radiusY =+ height * dimensions.height * 0.5 + radiusOffset * dimensions.height;+ const pixelLocalX = Math.cos(angle) * radiusX;+ const pixelLocalY = Math.sin(angle) * radiusY;+ const rotatedX = pixelLocalX * cosRotation - pixelLocalY * sinRotation;+ const rotatedY = pixelLocalX * sinRotation + pixelLocalY * cosRotation;++ return [+ center[0] + rotatedX / dimensions.width,+ center[1] + rotatedY / dimensions.height,+ ];+ }++ const radiusU = width / 2 + radiusOffset;+ const radiusV = height / 2 + radiusOffset;+ const localX = Math.cos(angle) * radiusU;+ const localY = Math.sin(angle) * radiusV;++ return [+ center[0] + localX * cosRotation - localY * sinRotation,+ center[1] + localX * sinRotation + localY * cosRotation,+ ];+};++const getUvEllipseValues = (+ handle: UvConnectionHandle,+): {+ width: number;+ height: number;+ rotation: number;+ innerScale: number | null;+} | null => {+ const {visual} = handle.fieldSchema;+ if (visual?.type !== 'ellipse') {+ return null;+ }++ const ellipseMetadata = visual;++ const controls = handle.ellipseControls;+ const width =+ controls?.width.value ??+ parseFiniteNumber(handle.effectValues?.[ellipseMetadata.width]);+ const height =+ controls?.height.value ??+ parseFiniteNumber(handle.effectValues?.[ellipseMetadata.height]);+ const rotation = ellipseMetadata.rotation+ ? (controls?.rotation?.value ??+ parseFiniteNumber(handle.effectValues?.[ellipseMetadata.rotation]))+ : 0;+ const innerScale = ellipseMetadata.innerScale+ ? (controls?.innerScale?.value ??+ parseFiniteNumber(handle.effectValues?.[ellipseMetadata.innerScale]))+ : null;++ if (width === null || height === null || rotation === null) {+ return null;+ }++ return {width, height, rotation, innerScale};+};+export const tuplesEqual = (left: unknown, right: UvCoordinate): boolean => {if (!Array.isArray(left) || left.length !== 2) {return false;@@ -176,13 +366,13 @@ export const getUvHandleConnectionLines = ({const lines: UvHandleConnectionLine[] = [];for (const handle of handles) {- const targetFieldKey = handle.fieldSchema.lineTo;- if (targetFieldKey === undefined || targetFieldKey === handle.fieldKey) {+ const {visual} = handle.fieldSchema;+ if (visual?.type !== 'line' || visual.to === handle.fieldKey) {continue;}const target = handlesByField.get(- `${handle.effectIndex}\u0000${targetFieldKey}`,+ `${handle.effectIndex}\u0000${visual.to}`,);if (target === undefined) {continue;@@ -190,7 +380,7 @@ export const getUvHandleConnectionLines = ({const pairKey = [handle.effectIndex,- ...[handle.fieldKey, targetFieldKey].sort(),+ ...[handle.fieldKey, visual.to].sort(),].join('\u0000');if (seenPairs.has(pairKey)) {continue;@@ -198,7 +388,7 @@ export const getUvHandleConnectionLines = ({seenPairs.add(pairKey);lines.push({- key: `${handle.effectIndex}-${handle.fieldKey}-${targetFieldKey}`,+ key: `${handle.effectIndex}-${handle.fieldKey}-${visual.to}`,from: getUvHandlePosition(points, handle.value),to: getUvHandlePosition(points, target.value),});@@ -207,6 +397,215 @@ export const getUvHandleConnectionLines = ({return lines;};+export const getUvHandleConnectionEllipses = ({+ handles,+ dimensions,+ points,+}: {+ readonly handles: readonly UvConnectionHandle[];+ readonly dimensions?: UvEllipseDimensions | null;+ readonly points: SelectedOutline['points'];+}): UvHandleConnectionEllipse[] => {+ const ellipses: UvHandleConnectionEllipse[] = [];++ for (const handle of handles) {+ const {visual} = handle.fieldSchema;+ if (visual?.type === 'ellipse') {+ const ellipseMetadata = visual;+ const ellipseValues = getUvEllipseValues(handle);+ if (ellipseValues === null) {+ continue;+ }++ const rotatedEllipsePoints: OutlinePoint[] = [];+ for (let i = 0; i <= 64; i++) {+ const angle = (i / 64) * Math.PI * 2;+ const uv = getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: ellipseValues.width,+ height: ellipseValues.height,+ rotation: ellipseValues.rotation,+ angle,+ });+ rotatedEllipsePoints.push(getUvHandlePosition(points, uv));+ }++ ellipses.push({+ key: [+ handle.effectIndex,+ handle.fieldKey,+ ellipseMetadata.width,+ ellipseMetadata.height,+ ellipseMetadata.rotation ?? 'rotation',+ ].join('-'),+ points: rotatedEllipsePoints,+ });++ if (+ ellipseMetadata.innerScale !== undefined &&+ ellipseValues.innerScale !== null+ ) {+ const startEllipsePoints: OutlinePoint[] = [];+ for (let i = 0; i <= 64; i++) {+ const angle = (i / 64) * Math.PI * 2;+ const uv = getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: ellipseValues.width * ellipseValues.innerScale,+ height: ellipseValues.height * ellipseValues.innerScale,+ rotation: ellipseValues.rotation,+ angle,+ });+ startEllipsePoints.push(getUvHandlePosition(points, uv));+ }++ ellipses.push({+ key: [+ handle.effectIndex,+ handle.fieldKey,+ ellipseMetadata.width,+ ellipseMetadata.height,+ ellipseMetadata.rotation ?? 'rotation',+ ellipseMetadata.innerScale,+ ].join('-'),+ points: startEllipsePoints,+ });+ }++ continue;+ }+ }++ return ellipses;+};++export const getUvEllipseInteractiveControls = ({+ handles,+ dimensions,+ points,+}: {+ readonly handles: readonly SelectedOutlineUvHandle[];+ readonly dimensions?: UvEllipseDimensions | null;+ readonly points: SelectedOutline['points'];+}): UvEllipseInteractiveControls[] => {+ const controls: UvEllipseInteractiveControls[] = [];++ for (const handle of handles) {+ if (+ handle.fieldSchema.visual?.type !== 'ellipse' ||+ handle.ellipseControls === null ||+ handle.ellipseControls === undefined+ ) {+ continue;+ }++ const ellipseValues = getUvEllipseValues(handle);+ if (ellipseValues === null) {+ continue;+ }++ const center = getUvHandlePosition(points, handle.value);+ const {rotation} = ellipseValues;+ const widthPoint = getUvHandlePosition(+ points,+ getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: ellipseValues.width,+ height: 0,+ rotation,+ angle: 0,+ }),+ );+ const heightPoint = getUvHandlePosition(+ points,+ getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: 0,+ height: ellipseValues.height,+ rotation,+ angle: Math.PI / 2,+ }),+ );+ const rotationPoint =+ handle.ellipseControls.rotation === null+ ? null+ : getUvHandlePosition(+ points,+ getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: 0,+ height: Math.max(ellipseValues.height, 0.001),+ rotation,+ angle: Math.PI / 2,+ radiusOffset: 0.08,+ }),+ );+ const startPoint =+ handle.ellipseControls.innerScale === null ||+ ellipseValues.innerScale === null+ ? null+ : getUvHandlePosition(+ points,+ getRotatedEllipseUv({+ center: handle.value,+ dimensions,+ width: ellipseValues.width * ellipseValues.innerScale,+ height: 0,+ rotation,+ angle: 0,+ }),+ );++ controls.push({+ handle,+ center,+ width: ellipseValues.width,+ height: ellipseValues.height,+ rotation,+ resize: [+ {+ key: `${handle.effectIndex}-${handle.fieldKey}-width`,+ axis: 'width',+ field: handle.ellipseControls.width,+ position: widthPoint,+ cursor: getResizeCursor(rotation),+ },+ {+ key: `${handle.effectIndex}-${handle.fieldKey}-height`,+ axis: 'height',+ field: handle.ellipseControls.height,+ position: heightPoint,+ cursor: getResizeCursor(rotation + 90),+ },+ ],+ rotationControl:+ handle.ellipseControls.rotation === null || rotationPoint === null+ ? null+ : {+ key: `${handle.effectIndex}-${handle.fieldKey}-rotation`,+ field: handle.ellipseControls.rotation,+ position: rotationPoint,+ cursor: getResizeCursor(rotation + 90),+ },+ startControl:+ handle.ellipseControls.innerScale === null || startPoint === null+ ? null+ : {+ key: `${handle.effectIndex}-${handle.fieldKey}-start`,+ field: handle.ellipseControls.innerScale,+ position: startPoint,+ cursor: getResizeCursor(rotation),+ },+ });+ }++ return controls;+};+const vectorBetween = (from: OutlinePoint, to: OutlinePoint): OutlinePoint => {return {x: to.x - from.x, y: to.y - from.y};};@@ -306,6 +705,118 @@ export function roundUvCoordinate(];}+export const roundNumericUvEllipseValue = (+ value: number,+ schema: NumericUvEllipseFieldSchema,+): number => {+ const min = schema.min ?? -Infinity;+ const max = schema.max ?? Infinity;+ const decimalPlaces = getTimelineDisplayDecimalPlaces({+ defaultDecimalPlaces: schema.type === 'rotation-degrees' ? 1 : 3,+ step: schema.step,+ });++ return roundToDecimalPlaces(clamp(value, min, max), decimalPlaces);+};++const getNumericUvEllipseControlField = ({+ activeSchema,+ effectStatus,+ effectValues,+ fieldKey,+}: {+ readonly activeSchema: InteractivitySchema;+ readonly effectStatus: Extract<+ ReturnType<typeof Internals.getEffectPropStatusesCtx>,+ {type: 'can-update-effect'}+ >;+ readonly effectValues: Record<string, unknown>;+ readonly fieldKey: string;+}): UvEllipseControlField | null => {+ const fieldSchema = activeSchema[fieldKey];+ if (+ fieldSchema?.type !== 'number' &&+ fieldSchema?.type !== 'rotation-degrees'+ ) {+ return null;+ }++ const propStatus = effectStatus.props[fieldKey];+ if (propStatus?.status !== 'static' && propStatus?.status !== 'keyframed') {+ return null;+ }++ const value = parseFiniteNumber(effectValues[fieldKey]);+ if (value === null) {+ return null;+ }++ return {+ fieldKey,+ fieldSchema,+ fieldDefault: fieldSchema.default,+ propStatus,+ value,+ };+};++const getUvEllipseControls = ({+ activeSchema,+ effectStatus,+ effectValues,+ fieldSchema,+}: {+ readonly activeSchema: InteractivitySchema;+ readonly effectStatus: Extract<+ ReturnType<typeof Internals.getEffectPropStatusesCtx>,+ {type: 'can-update-effect'}+ >;+ readonly effectValues: Record<string, unknown>;+ readonly fieldSchema: UvCoordinateFieldSchema;+}): UvEllipseControls | null => {+ const {visual} = fieldSchema;+ if (visual?.type !== 'ellipse') {+ return null;+ }++ const width = getNumericUvEllipseControlField({+ activeSchema,+ effectStatus,+ effectValues,+ fieldKey: visual.width,+ });+ const height = getNumericUvEllipseControlField({+ activeSchema,+ effectStatus,+ effectValues,+ fieldKey: visual.height,+ });+ const rotation =+ visual.rotation === undefined+ ? null+ : getNumericUvEllipseControlField({+ activeSchema,+ effectStatus,+ effectValues,+ fieldKey: visual.rotation,+ });+ const innerScale =+ visual.innerScale === undefined+ ? null+ : getNumericUvEllipseControlField({+ activeSchema,+ effectStatus,+ effectValues,+ fieldKey: visual.innerScale,+ });++ if (width === null || height === null) {+ return null;+ }++ return {width, height, rotation, innerScale};+};+export const getSelectedUvHandles = ({propStatuses,clientId,@@ -368,9 +879,9 @@ export const getSelectedUvHandles = ({shouldResortToDefaultValueIfUndefined: false,});});-+ const effectValues: Record<string, unknown> = {};for (const [fieldKey, fieldSchema] of Object.entries(activeSchema)) {- if (fieldSchema.type !== 'uv-coordinate') {+ if (fieldSchema.type === 'hidden') {continue;}@@ -382,14 +893,29 @@ export const getSelectedUvHandles = ({continue;}- const dragOverrideValue = dragOverrides[fieldKey];- const effectiveValue = Internals.getEffectiveVisualModeValue({+ effectValues[fieldKey] = Internals.getEffectiveVisualModeValue({propStatus,- dragOverrideValue,+ dragOverrideValue: dragOverrides[fieldKey],defaultValue: fieldSchema.default,frame: sourceFrame,shouldResortToDefaultValueIfUndefined: true,});+ }++ for (const [fieldKey, fieldSchema] of Object.entries(activeSchema)) {+ if (fieldSchema.type !== 'uv-coordinate') {+ continue;+ }++ const propStatus = effectStatus.props[fieldKey];+ if (+ propStatus?.status !== 'static' &&+ propStatus?.status !== 'keyframed'+ ) {+ continue;+ }++ const effectiveValue = effectValues[fieldKey];const value = parseUvCoordinate(effectiveValue);if (value === null) {continue;@@ -399,6 +925,13 @@ export const getSelectedUvHandles = ({clientId,propStatus,effectIndex,+ effectValues,+ ellipseControls: getUvEllipseControls({+ activeSchema,+ effectStatus,+ effectValues,+ fieldSchema,+ }),fieldDefault: fieldSchema.default,fieldKey,fieldSchema,diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex a1e1dd6b14..fba634fdcb 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -16,10 +16,13 @@ import type {SelectedOutlineTarget} from '../components/selected-outline-types';import {constrainUv,getSelectedUvHandles,+ getUvEllipseInteractiveControls,getUvCoordinateForPoint,+ getUvHandleConnectionEllipses,getUvHandleConnectionLines,getUvHandlePosition,roundUvCoordinate,+ type SelectedOutlineUvHandle,} from '../components/selected-outline-uv';import {applySelectedOutlineDragAxisLock,@@ -2038,7 +2041,10 @@ test('UV handle connection lines connect fields from schema metadata', () => {fieldSchema: {type: 'uv-coordinate',default: [0, 0],- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },},value: [0.2, 0.3],},@@ -2080,7 +2086,10 @@ test('UV handle connection lines stay within the same effect instance', () => {fieldSchema: {type: 'uv-coordinate',default: [0, 0],- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },},value: [0.2, 0.3],},@@ -2099,7 +2108,10 @@ test('UV handle connection lines stay within the same effect instance', () => {fieldSchema: {type: 'uv-coordinate',default: [0, 0],- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },},value: [0.2, 0.3],},@@ -2109,7 +2121,10 @@ test('UV handle connection lines stay within the same effect instance', () => {fieldSchema: {type: 'uv-coordinate',default: [1, 1],- lineTo: 'start',+ visual: {+ type: 'line',+ to: 'start',+ },},value: [0.8, 0.7],},@@ -2119,6 +2134,335 @@ test('UV handle connection lines stay within the same effect instance', () => {expect(lines.map((line) => line.key)).toEqual(['2-start-end']);});+test('UV handle connection ellipses use numeric ellipse fields from schema metadata', () => {+ const points = [+ {x: 0, y: 0},+ {x: 100, y: 0},+ {x: 100, y: 100},+ {x: 0, y: 100},+ ] as const;++ const ellipses = getUvHandleConnectionEllipses({+ points,+ handles: [+ {+ effectIndex: 0,+ fieldKey: 'center',+ fieldSchema: {+ type: 'uv-coordinate',+ default: [0.5, 0.5],+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ },+ effectValues: {+ width: 0.6,+ height: 0.4,+ rotation: 90,+ start: 0.5,+ },+ value: [0.5, 0.5],+ },+ ],+ });++ expect(ellipses).toHaveLength(2);+ expect(ellipses[0].key).toBe('0-center-width-height-rotation');+ expect(ellipses[0].points[0].x).toBeCloseTo(50);+ expect(ellipses[0].points[0].y).toBeCloseTo(80);+ expect(ellipses[0].points[16].x).toBeCloseTo(30);+ expect(ellipses[0].points[16].y).toBeCloseTo(50);+ expect(ellipses[0].points[32].x).toBeCloseTo(50);+ expect(ellipses[0].points[32].y).toBeCloseTo(20);+ expect(ellipses[0].points[48].x).toBeCloseTo(70);+ expect(ellipses[0].points[48].y).toBeCloseTo(50);+ expect(ellipses[1].key).toBe('0-center-width-height-rotation-start');+ expect(ellipses[1].points[0].x).toBeCloseTo(50);+ expect(ellipses[1].points[0].y).toBeCloseTo(65);+ expect(ellipses[1].points[16].x).toBeCloseTo(40);+ expect(ellipses[1].points[16].y).toBeCloseTo(50);+ expect(ellipses[1].points[32].x).toBeCloseTo(50);+ expect(ellipses[1].points[32].y).toBeCloseTo(35);+ expect(ellipses[1].points[48].x).toBeCloseTo(60);+ expect(ellipses[1].points[48].y).toBeCloseTo(50);+});++test('UV handle connection ellipses rotate numeric fields in pixel space', () => {+ const points = [+ {x: 0, y: 0},+ {x: 200, y: 0},+ {x: 200, y: 100},+ {x: 0, y: 100},+ ] as const;++ const ellipses = getUvHandleConnectionEllipses({+ dimensions: {width: 200, height: 100},+ points,+ handles: [+ {+ effectIndex: 0,+ fieldKey: 'center',+ fieldSchema: {+ type: 'uv-coordinate',+ default: [0.5, 0.5],+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ },+ effectValues: {+ width: 0.6,+ height: 0.4,+ rotation: 90,+ start: 0.5,+ },+ value: [0.5, 0.5],+ },+ ],+ });++ expect(ellipses).toHaveLength(2);+ expect(ellipses[0].points[0].x).toBeCloseTo(100);+ expect(ellipses[0].points[0].y).toBeCloseTo(110);+ expect(ellipses[0].points[16].x).toBeCloseTo(80);+ expect(ellipses[0].points[16].y).toBeCloseTo(50);+ expect(ellipses[0].points[32].x).toBeCloseTo(100);+ expect(ellipses[0].points[32].y).toBeCloseTo(-10);+ expect(ellipses[0].points[48].x).toBeCloseTo(120);+ expect(ellipses[0].points[48].y).toBeCloseTo(50);+ expect(ellipses[1].points[0].x).toBeCloseTo(100);+ expect(ellipses[1].points[0].y).toBeCloseTo(80);+ expect(ellipses[1].points[16].x).toBeCloseTo(90);+ expect(ellipses[1].points[16].y).toBeCloseTo(50);+ expect(ellipses[1].points[32].x).toBeCloseTo(100);+ expect(ellipses[1].points[32].y).toBeCloseTo(20);+ expect(ellipses[1].points[48].x).toBeCloseTo(110);+ expect(ellipses[1].points[48].y).toBeCloseTo(50);+});++test('UV ellipse interactive controls expose resize and rotation handles', () => {+ const points = [+ {x: 0, y: 0},+ {x: 100, y: 0},+ {x: 100, y: 100},+ {x: 0, y: 100},+ ] as const;+ const nodePath = makeKey(['body', 0]);+ const schema = {+ center: {+ type: 'uv-coordinate',+ default: [0.5, 0.5],+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ },+ width: {+ type: 'number',+ default: 0.6,+ hiddenFromList: false,+ },+ height: {+ type: 'number',+ default: 0.4,+ hiddenFromList: false,+ },+ rotation: {+ type: 'rotation-degrees',+ default: 90,+ },+ start: {+ type: 'number',+ default: 0.5,+ hiddenFromList: false,+ },+ } as const satisfies InteractivitySchema;+ const handle = {+ clientId: 'client-id',+ effectIndex: 0,+ effectValues: {+ center: [0.5, 0.5],+ width: 0.6,+ height: 0.4,+ rotation: 90,+ start: 0.5,+ },+ ellipseControls: {+ width: {+ fieldKey: 'width',+ fieldSchema: schema.width,+ fieldDefault: schema.width.default,+ propStatus: {status: 'static', codeValue: 0.6},+ value: 0.6,+ },+ height: {+ fieldKey: 'height',+ fieldSchema: schema.height,+ fieldDefault: schema.height.default,+ propStatus: {status: 'static', codeValue: 0.4},+ value: 0.4,+ },+ rotation: {+ fieldKey: 'rotation',+ fieldSchema: schema.rotation,+ fieldDefault: schema.rotation.default,+ propStatus: {status: 'static', codeValue: 90},+ value: 90,+ },+ start: {+ fieldKey: 'start',+ fieldSchema: schema.start,+ fieldDefault: schema.start.default,+ propStatus: {status: 'static', codeValue: 0.5},+ value: 0.5,+ },+ },+ fieldDefault: schema.center.default,+ fieldKey: 'center',+ fieldSchema: schema.center,+ isSelected: true,+ nodePath,+ propStatus: {status: 'static', codeValue: [0.5, 0.5]},+ schema,+ sourceFrame: 0,+ value: [0.5, 0.5],+ } as unknown as SelectedOutlineUvHandle;++ const controls = getUvEllipseInteractiveControls({+ handles: [handle],+ points,+ });++ expect(controls).toHaveLength(1);+ expect(controls[0].center).toEqual({x: 50, y: 50});+ expect(controls[0].resize[0].axis).toBe('width');+ expect(controls[0].resize[0].position.x).toBeCloseTo(50);+ expect(controls[0].resize[0].position.y).toBeCloseTo(80);+ expect(controls[0].resize[1].axis).toBe('height');+ expect(controls[0].resize[1].position.x).toBeCloseTo(30);+ expect(controls[0].resize[1].position.y).toBeCloseTo(50);+ expect(controls[0].rotationControl?.position.x).toBeCloseTo(22);+ expect(controls[0].rotationControl?.position.y).toBeCloseTo(50);+ expect(controls[0].startControl?.position.x).toBeCloseTo(50);+ expect(controls[0].startControl?.position.y).toBeCloseTo(65);+});++test('UV ellipse interactive controls rotate numeric fields in pixel space', () => {+ const points = [+ {x: 0, y: 0},+ {x: 200, y: 0},+ {x: 200, y: 100},+ {x: 0, y: 100},+ ] as const;+ const nodePath = makeKey(['body', 0]);+ const schema = {+ center: {+ type: 'uv-coordinate',+ default: [0.5, 0.5],+ visual: {+ type: 'ellipse',+ width: 'width',+ height: 'height',+ rotation: 'rotation',+ innerScale: 'start',+ },+ },+ width: {+ type: 'number',+ default: 0.6,+ hiddenFromList: false,+ },+ height: {+ type: 'number',+ default: 0.4,+ hiddenFromList: false,+ },+ rotation: {+ type: 'rotation-degrees',+ default: 90,+ },+ start: {+ type: 'number',+ default: 0.5,+ hiddenFromList: false,+ },+ } as const satisfies InteractivitySchema;+ const handle = {+ clientId: 'client-id',+ effectIndex: 0,+ effectValues: {+ center: [0.5, 0.5],+ width: 0.6,+ height: 0.4,+ rotation: 90,+ start: 0.5,+ },+ ellipseControls: {+ width: {+ fieldKey: 'width',+ fieldSchema: schema.width,+ fieldDefault: schema.width.default,+ propStatus: {status: 'static', codeValue: 0.6},+ value: 0.6,+ },+ height: {+ fieldKey: 'height',+ fieldSchema: schema.height,+ fieldDefault: schema.height.default,+ propStatus: {status: 'static', codeValue: 0.4},+ value: 0.4,+ },+ rotation: {+ fieldKey: 'rotation',+ fieldSchema: schema.rotation,+ fieldDefault: schema.rotation.default,+ propStatus: {status: 'static', codeValue: 90},+ value: 90,+ },+ start: {+ fieldKey: 'start',+ fieldSchema: schema.start,+ fieldDefault: schema.start.default,+ propStatus: {status: 'static', codeValue: 0.5},+ value: 0.5,+ },+ },+ fieldDefault: schema.center.default,+ fieldKey: 'center',+ fieldSchema: schema.center,+ isSelected: true,+ nodePath,+ propStatus: {status: 'static', codeValue: [0.5, 0.5]},+ schema,+ sourceFrame: 0,+ value: [0.5, 0.5],+ } as unknown as SelectedOutlineUvHandle;++ const controls = getUvEllipseInteractiveControls({+ dimensions: {width: 200, height: 100},+ handles: [handle],+ points,+ });++ expect(controls).toHaveLength(1);+ expect(controls[0].resize[0].position.x).toBeCloseTo(100);+ expect(controls[0].resize[0].position.y).toBeCloseTo(110);+ expect(controls[0].resize[1].position.x).toBeCloseTo(80);+ expect(controls[0].resize[1].position.y).toBeCloseTo(50);+ expect(controls[0].startControl?.position.x).toBeCloseTo(100);+ expect(controls[0].startControl?.position.y).toBeCloseTo(80);+});+const getUvHandlesForSelectedEffectChild = (selectedFieldKey: string) => {const sequenceNodePathInfo = makeNodePathInfo(['body', 0], []);const effectPropNodePathInfo = makeNodePathInfo(@@ -2130,7 +2474,10 @@ const getUvHandlesForSelectedEffectChild = (selectedFieldKey: string) => {start: {type: 'uv-coordinate',default: [0, 0],- lineTo: 'end',+ visual: {+ type: 'line',+ to: 'end',+ },},end: {type: 'uv-coordinate',