🎥 Make videos programmatically with React
New package: `@remotion/rough-notation` (#9018)
Jonny Burger05fb9f9c3ce3
diff --git a/.agents/skills/writing-docs/SKILL.md b/.agents/skills/writing-docs/SKILL.mdindex 98182244f4..7cd79a6c86 100644--- a/.agents/skills/writing-docs/SKILL.md+++ b/.agents/skills/writing-docs/SKILL.md@@ -36,6 +36,8 @@ crumb: '@remotion/my-package'**Compatibility tables**: API pages should ideally include a `## Compatibility` section with `<CompatibilityTable>` before `## See also`.+**Sidebar order**: When adding or moving docs in `packages/docs/sidebars.ts`, inspect the surrounding entries and match the ordering logic already used there. If a section is alphabetical, place the new entry alphabetically; if it is grouped by workflow or importance, place it consistently with that grouping. Do not leave new additions as one-off outliers.+## Language guidelines- **Keep it brief**: Developers don't like to read. Extra words cause information loss.diff --git a/bun.lock b/bun.lockindex c2b1c5c99b..5f32834056 100644--- a/bun.lock+++ b/bun.lock@@ -106,6 +106,7 @@"@remotion/media-utils": "workspace:*","@remotion/noise": "workspace:*","@remotion/paths": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/shapes": "workspace:*","@remotion/starburst": "workspace:*","@remotion/svg-3d-engine": "workspace:*",@@ -505,6 +506,7 @@"@remotion/promo-pages": "workspace:*","@remotion/renderer": "workspace:*","@remotion/rive": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/rounded-text-box": "workspace:*","@remotion/sfx": "workspace:*","@remotion/shapes": "workspace:*",@@ -748,6 +750,7 @@"@remotion/preload": "workspace:*","@remotion/renderer": "workspace:*","@remotion/rive": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/rounded-text-box": "workspace:*","@remotion/sfx": "workspace:*","@remotion/shapes": "workspace:*",@@ -1438,6 +1441,26 @@"react-dom": ">=18.2.0",},},+ "packages/rough-notation": {+ "name": "@remotion/rough-notation",+ "version": "4.0.489",+ "dependencies": {+ "@remotion/paths": "workspace:*",+ "remotion": "workspace:*",+ "roughjs": "4.6.6",+ },+ "devDependencies": {+ "@remotion/eslint-config-internal": "workspace:*",+ "@typescript/native-preview": "catalog:",+ "eslint": "catalog:",+ "react": "catalog:",+ "react-dom": "catalog:",+ },+ "peerDependencies": {+ "react": ">=16.8.0",+ "react-dom": ">=16.8.0",+ },+ },"packages/rounded-text-box": {"name": "@remotion/rounded-text-box","version": "4.0.489",@@ -4090,6 +4113,8 @@"@remotion/rive": ["@remotion/rive@workspace:packages/rive"],+ "@remotion/rough-notation": ["@remotion/rough-notation@workspace:packages/rough-notation"],+"@remotion/rounded-text-box": ["@remotion/rounded-text-box@workspace:packages/rounded-text-box"],"@remotion/serverless": ["@remotion/serverless@workspace:packages/serverless"],@@ -6130,6 +6155,8 @@"h3": ["[email protected]", "", { "dependencies": { "cookie-es": "^1.2.3", "crossws": "^0.3.5", "defu": "^6.1.6", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", "node-mock-http": "^1.0.4", "radix3": "^1.1.2", "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, "sha512-L3THSe2MPeBwgIZVSH5zLdBBU90TOxarvhK9d04IDY2AmVS8j2Jz2LIWtwsGOU3lu2I5jCN7FNvVfY2+XyF+mg=="],+ "hachure-fill": ["[email protected]", "", {}, "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg=="],+"handle-thing": ["[email protected]", "", {}, "sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg=="],"happy-dom": ["[email protected]", "", { "dependencies": { "@types/node": "^20.0.0", "@types/whatwg-mimetype": "^3.0.2", "whatwg-mimetype": "^3.0.0" } }, "sha512-pYOyu624+6HDbY+qkjILpQGnpvZOusItCk+rvF5/V+6NkcgTKnbOldpIy22tBnxoaLtlM9nXgoqAcW29/B7CIw=="],@@ -7026,6 +7053,8 @@"path-browserify": ["[email protected]", "", {}, "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g=="],+ "path-data-parser": ["[email protected]", "", {}, "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w=="],+"path-exists": ["[email protected]", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],"path-is-absolute": ["[email protected]", "", {}, "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg=="],@@ -7088,6 +7117,10 @@"point-in-polygon-hao": ["[email protected]", "", { "dependencies": { "robust-predicates": "^3.0.2" } }, "sha512-x2pcvXeqhRHlNRdhLs/tgFapAbSSe86wa/eqmj1G6pWftbEs5aVRJhRGM6FYSUERKu0PjekJzMq0gsI2XyiclQ=="],+ "points-on-curve": ["[email protected]", "", {}, "sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A=="],++ "points-on-path": ["[email protected]", "", { "dependencies": { "path-data-parser": "0.1.0", "points-on-curve": "0.2.0" } }, "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g=="],+"polished": ["[email protected]", "", { "dependencies": { "@babel/runtime": "7.27.1" } }, "sha512-OBatVyC/N7SCW/FaDHrSd+vn0o5cS855TOmYi4OkdWUMSJCET/xip//ch8xGUvtr3i44X9LVyWwQlRMTN3pwSA=="],"polyclip-ts": ["[email protected]", "", { "dependencies": { "bignumber.js": "^9.1.0", "splaytree-ts": "^1.0.2" } }, "sha512-JPtKbDRuPEuAjuTdhR62Gph7Is2BS1Szx69CFOO3g71lpJDFo78k4tFyi+qFOMVPePEzdSKkpGU3NBXPHHjvKQ=="],@@ -7518,6 +7551,8 @@"rollup": ["[email protected]", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.60.2", "@rollup/rollup-android-arm64": "4.60.2", "@rollup/rollup-darwin-arm64": "4.60.2", "@rollup/rollup-darwin-x64": "4.60.2", "@rollup/rollup-freebsd-arm64": "4.60.2", "@rollup/rollup-freebsd-x64": "4.60.2", "@rollup/rollup-linux-arm-gnueabihf": "4.60.2", "@rollup/rollup-linux-arm-musleabihf": "4.60.2", "@rollup/rollup-linux-arm64-gnu": "4.60.2", "@rollup/rollup-linux-arm64-musl": "4.60.2", "@rollup/rollup-linux-loong64-gnu": "4.60.2", "@rollup/rollup-linux-loong64-musl": "4.60.2", "@rollup/rollup-linux-ppc64-gnu": "4.60.2", "@rollup/rollup-linux-ppc64-musl": "4.60.2", "@rollup/rollup-linux-riscv64-gnu": "4.60.2", "@rollup/rollup-linux-riscv64-musl": "4.60.2", "@rollup/rollup-linux-s390x-gnu": "4.60.2", "@rollup/rollup-linux-x64-gnu": "4.60.2", "@rollup/rollup-linux-x64-musl": "4.60.2", "@rollup/rollup-openbsd-x64": "4.60.2", "@rollup/rollup-openharmony-arm64": "4.60.2", "@rollup/rollup-win32-arm64-msvc": "4.60.2", "@rollup/rollup-win32-ia32-msvc": "4.60.2", "@rollup/rollup-win32-x64-gnu": "4.60.2", "@rollup/rollup-win32-x64-msvc": "4.60.2", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-J9qZyW++QK/09NyN/zeO0dG/1GdGfyp9lV8ajHnRVLfo/uFsbji5mHnDgn/qYdUHyCkM2N+8VyspgZclfAh0eQ=="],+ "roughjs": ["[email protected]", "", { "dependencies": { "hachure-fill": "^0.5.2", "path-data-parser": "^0.1.0", "points-on-curve": "^0.2.0", "points-on-path": "^0.2.1" } }, "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ=="],+"router": ["[email protected]", "", { "dependencies": { "debug": "4.4.1", "depd": "2.0.0", "is-promise": "4.0.0", "parseurl": "1.3.3", "path-to-regexp": "8.2.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="],"rtlcss": ["[email protected]", "", { "dependencies": { "escalade": "3.2.0", "picocolors": "1.1.1", "postcss": "8.5.1", "strip-json-comments": "3.1.1" }, "bin": { "rtlcss": "bin/rtlcss.js" } }, "sha512-/oVHgBtnPNcggP2aVXQjSy6N1mMAfHg4GSag0QtZBlD5bdDgAHwr4pydqJGd+SUCu9260+Pjqbjwtvu7EMH1KQ=="],diff --git a/packages/brand/package.json b/packages/brand/package.jsonindex d6de1f75f8..689d469b6d 100644--- a/packages/brand/package.json+++ b/packages/brand/package.json@@ -25,6 +25,7 @@"@remotion/media-utils": "workspace:*","@remotion/noise": "workspace:*","@remotion/paths": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/shapes": "workspace:*","@remotion/starburst": "workspace:*","@remotion/svg-3d-engine": "workspace:*",diff --git a/packages/brand/src/Root.tsx b/packages/brand/src/Root.tsxindex 9bad858f1a..2a5d96a954 100644--- a/packages/brand/src/Root.tsx+++ b/packages/brand/src/Root.tsx@@ -44,6 +44,10 @@ import {PatternEffectShowcase,patternEffectShowcaseDurationInFrames,} from './effects/PatternEffectShowcase';+import {+ RoughNotationShowcase,+ roughNotationShowcaseDurationInFrames,+} from './effects/RoughNotationShowcase';import {StarburstEffectShowcase,starburstEffectShowcaseDurationInFrames,@@ -286,6 +290,14 @@ export const RemotionRoot: React.FC = () => {/></Folder><Folder name="effects">+ <Composition+ id="rough-notation-showcase"+ component={RoughNotationShowcase}+ durationInFrames={roughNotationShowcaseDurationInFrames}+ fps={30}+ width={1080}+ height={1080}+ /><Compositionid="corner-pin-effect-showcase"component={CornerPinEffectShowcase}diff --git a/packages/brand/src/effects/RoughNotationShowcase.tsx b/packages/brand/src/effects/RoughNotationShowcase.tsxnew file mode 100644index 0000000000..da02afc3ec--- /dev/null+++ b/packages/brand/src/effects/RoughNotationShowcase.tsx@@ -0,0 +1,246 @@+import {gridlines} from '@remotion/effects/gridlines';+import {paper} from '@remotion/effects/paper';+import {vignette} from '@remotion/effects/vignette';+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {+ Box,+ Bracket,+ Circle,+ CrossedOff,+ Highlight,+ StrikeThrough,+ Underline,+} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Series,+ Solid,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const WIDTH = 1080;+const HEIGHT = 1080;+const SLIDE_DURATION = 54;++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const slides = [+ 'highlight',+ 'underline',+ 'circle',+ 'box',+ 'crossed-off',+ 'strike-through',+ 'bracket',+] as const;++type Slide = (typeof slides)[number];++export const roughNotationShowcaseDurationInFrames =+ slides.length * SLIDE_DURATION;++const renderAnnotation = ({+ type,+ progress,+}: {+ readonly type: Slide;+ readonly progress: number;+}) => {+ if (type === 'highlight') {+ return (+ <Highlight+ progress={progress}+ color="rgba(255, 221, 64, 0.72)"+ roughness={2.3}+ maxRandomnessOffset={10}+ padding={{left: 18, right: 18}}+ >+ Highlight+ </Highlight>+ );+ }++ if (type === 'underline') {+ return (+ <Underline+ progress={progress}+ color="#ef5b3f"+ strokeWidth={12}+ roughness={1.8}+ padding={{top: -4}}+ >+ Underline+ </Underline>+ );+ }++ if (type === 'circle') {+ return (+ <Circle+ progress={progress}+ color="#2563eb"+ strokeWidth={12}+ roughness={1.8}+ padding={{left: 42, right: 51, top: 16, bottom: 26}}+ box="inside"+ >+ Circle+ </Circle>+ );+ }++ if (type === 'box') {+ return (+ <Box+ progress={progress}+ color="#14805e"+ strokeWidth={10}+ roughness={1.7}+ padding={{left: 18, right: 18, top: 4, bottom: 4}}+ >+ Box+ </Box>+ );+ }++ if (type === 'crossed-off') {+ return (+ <CrossedOff+ progress={progress}+ color="#df2f2f"+ strokeWidth={10}+ iterations={3}+ roughness={1.8}+ >+ Crossed Off+ </CrossedOff>+ );+ }++ if (type === 'strike-through') {+ return (+ <StrikeThrough+ progress={progress}+ color="#df2f2f"+ strokeWidth={12}+ iterations={2}+ roughness={1.8}+ >+ Strike Through+ </StrikeThrough>+ );+ }++ return (+ <Bracket+ progress={progress}+ color="#7c3aed"+ strokeWidth={11}+ roughness={1.7}+ bracketLeft+ bracketRight+ padding={{left: 20, right: 20, top: 8, bottom: 8}}+ >+ Bracket+ </Bracket>+ );+};++const AnnotationSlide: React.FC<{readonly type: Slide}> = ({type}) => {+ const frame = useCurrentFrame();+ const progress = interpolate(frame, [8, 30], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.22, 1, 0.36, 1),+ });+ const opacity = interpolate(+ frame,+ [0, 6, SLIDE_DURATION - 7, SLIDE_DURATION - 1],+ [0, 1, 1, 0],+ {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ },+ );+ const scale = interpolate(frame, [0, 8], [0.97, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.out(Easing.cubic),+ });++ return (+ <AbsoluteFill+ style={{+ alignItems: 'center',+ justifyContent: 'center',+ opacity,+ transform: `scale(${scale})`,+ }}+ >+ <div+ style={{+ color: '#17130f',+ fontFamily,+ fontSize: 154,+ fontWeight: 700,+ lineHeight: 1.1,+ textAlign: 'center',+ whiteSpace: 'nowrap',+ }}+ >+ {renderAnnotation({type, progress})}+ </div>+ </AbsoluteFill>+ );+};++export const RoughNotationShowcase: React.FC = () => {+ return (+ <AbsoluteFill style={{backgroundColor: '#f5f0e6'}}>+ <Solid+ width={WIDTH}+ height={HEIGHT}+ color="#f5f0e6"+ showInTimeline={false}+ effects={[+ paper({+ amount: 0.38,+ colorFront: 'white',+ colorBack: 'white',+ contrast: 0.18,+ roughness: 0.18,+ fiber: 0.28,+ crumples: 0.1,+ folds: 0.12,+ seed: 24,+ scale: 0.8,+ }),+ gridlines({+ gridSize: 54,+ lineWidth: 1.25,+ lineColor: 'rgba(76, 101, 128, 0.16)',+ }),+ vignette({+ amount: 0.3,+ radius: 0.72,+ feather: 0.38,+ color: '#2b2118',+ }),+ ]}+ />+ <Series>+ {slides.map((type) => (+ <Series.Sequence key={type} durationInFrames={SLIDE_DURATION}>+ <AnnotationSlide type={type} />+ </Series.Sequence>+ ))}+ </Series>+ </AbsoluteFill>+ );+};diff --git a/packages/cli/src/list-of-remotion-packages.ts b/packages/cli/src/list-of-remotion-packages.tsindex 0664621f08..0ad29c4291 100644--- a/packages/cli/src/list-of-remotion-packages.ts+++ b/packages/cli/src/list-of-remotion-packages.ts@@ -93,6 +93,7 @@ export const listOfRemotionPackages = ['@remotion/web-renderer','@remotion/design','@remotion/light-leaks',+ '@remotion/rough-notation','@remotion/starburst','@remotion/vercel','@remotion/sfx',diff --git a/packages/core/src/Interactive.tsx b/packages/core/src/Interactive.tsxindex 319f3ea427..e1475a515e 100644--- a/packages/core/src/Interactive.tsx+++ b/packages/core/src/Interactive.tsx@@ -1,5 +1,8 @@import React, {forwardRef, useCallback, useRef} from 'react';-import type {SequenceControls} from './CompositionManager.js';+import type {+ JsxComponentIdentity,+ SequenceControls,+} from './CompositionManager.js';import {addSequenceStackTraces} from './enable-sequence-stack-traces.js';import {baseSchema,@@ -101,6 +104,35 @@ type InteractiveElementComponent<Tag extends InteractiveTag> =InteractiveElementProps<Tag> & React.RefAttributes<ElementForTag<Tag>>>;+type RemotionComponentIdentityPackage = 'remotion' | `@remotion/${string}`;++const sourcePathToIdentityPrefix = (+ packageName: RemotionComponentIdentityPackage,+): string => {+ if (packageName === 'remotion') {+ return 'dev.remotion.remotion';+ }++ if (packageName.startsWith('@remotion/')) {+ const normalizedPackageName = packageName+ .slice('@remotion/'.length)+ .replace(/-([a-z])/g, (_, char: string) => char.toUpperCase());+ return `dev.remotion.${normalizedPackageName}`;+ }++ throw new Error(`Unsupported Remotion package name: ${packageName}`);+};++const makeRemotionComponentIdentity = ({+ packageName,+ componentName,+}: {+ readonly packageName: RemotionComponentIdentityPackage;+ readonly componentName: string;+}): JsxComponentIdentity => {+ return `${sourcePathToIdentityPrefix(packageName)}.${componentName}`;+};+const interactiveElementSchema = {...baseSchema,...transformSchema,@@ -183,7 +215,10 @@ const makeInteractiveElement = <Tag extends InteractiveTag>(const Wrapped = withInteractivitySchema({Component: Inner,componentName: displayName,- componentIdentity: `dev.remotion.remotion.${displayName.slice(1, -1)}`,+ componentIdentity: makeRemotionComponentIdentity({+ packageName: 'remotion',+ componentName: displayName.slice(1, -1),+ }),schema: interactiveElementSchema,supportsEffects: false,}) as InteractiveElementComponent<Tag>;@@ -204,6 +239,7 @@ export const Interactive = {premountSchema,sequenceSchema,withSchema: withInteractivitySchema,+ _internalMakeRemotionComponentIdentity: makeRemotionComponentIdentity,A: makeInteractiveElement('a', '<Interactive.A>'),Article: makeInteractiveElement('article', '<Interactive.Article>'),Aside: makeInteractiveElement('aside', '<Interactive.Aside>'),diff --git a/packages/core/src/test/with-interactivity-schema-helpers.test.ts b/packages/core/src/test/with-interactivity-schema-helpers.test.tsindex 08366e750d..0645c22e36 100644--- a/packages/core/src/test/with-interactivity-schema-helpers.test.ts+++ b/packages/core/src/test/with-interactivity-schema-helpers.test.ts@@ -61,6 +61,27 @@ test('pixelDensity is exposed only by canvas-backed component schemas', () => {expect('pixelDensity' in Interactive.baseSchema).toBe(false);});+test('_internalMakeRemotionComponentIdentity normalizes first-party package names', () => {+ expect(+ Interactive._internalMakeRemotionComponentIdentity({+ packageName: 'remotion',+ componentName: 'Sequence',+ }),+ ).toBe('dev.remotion.remotion.Sequence');+ expect(+ Interactive._internalMakeRemotionComponentIdentity({+ packageName: '@remotion/light-leaks',+ componentName: 'LightLeak',+ }),+ ).toBe('dev.remotion.lightLeaks.LightLeak');+ expect(+ Interactive._internalMakeRemotionComponentIdentity({+ packageName: '@remotion/rough-notation',+ componentName: 'Highlight',+ }),+ ).toBe('dev.remotion.roughNotation.Highlight');+});+test('getFlatSchema(sequenceSchema) exposes every variant key', () => {const flat = getFlatSchemaWithAllKeys(sequenceSchema);expect(Object.keys(flat).sort()).toEqual(diff --git a/packages/create-video/src/list-of-remotion-packages.ts b/packages/create-video/src/list-of-remotion-packages.tsindex 0664621f08..0ad29c4291 100644--- a/packages/create-video/src/list-of-remotion-packages.ts+++ b/packages/create-video/src/list-of-remotion-packages.ts@@ -93,6 +93,7 @@ export const listOfRemotionPackages = ['@remotion/web-renderer','@remotion/design','@remotion/light-leaks',+ '@remotion/rough-notation','@remotion/starburst','@remotion/vercel','@remotion/sfx',diff --git a/packages/docs/components/TableOfContents/api.tsx b/packages/docs/components/TableOfContents/api.tsxindex 50d3573938..0e34d40c8e 100644--- a/packages/docs/components/TableOfContents/api.tsx+++ b/packages/docs/components/TableOfContents/api.tsx@@ -27,6 +27,7 @@ import {TableOfContents as PreloadTableOfContents} from '../../docs/preload/tablimport {TableOfContents as RemotionTableOfContents} from '../../docs/remotion/table-of-contents';import {TableOfContents as RendererTableOfContents} from '../../docs/renderer/TableOfContents';import {TableOfContents as RiveTableOfContents} from '../../docs/rive/table-of-contents';+import {TableOfContents as RoughNotationTableOfContents} from '../../docs/rough-notation/table-of-contents';import {TableOfContents as SfxTableOfContents} from '../../docs/sfx/table-of-contents';import {TableOfContents as ShapesTableOfContents} from '../../docs/shapes/table-of-contents';import {TableOfContents as SkiaTableOfContents} from '../../docs/skia/TableOfContents';@@ -110,6 +111,9 @@ export const TableOfContents: React.FC = () => {<h2>@remotion/light-leaks</h2><p>Light Leak effects</p><LightLeaksTableOfContents />+ <h2>@remotion/rough-notation</h2>+ <p>Rough annotation primitives</p>+ <RoughNotationTableOfContents /><h2>@remotion/lottie</h2><p>Include a Lottie animation in your video</p><LottieTableOfContents apisOnly />diff --git a/packages/docs/components/TextHighlightExamples.tsx b/packages/docs/components/TextHighlightExamples.tsxnew file mode 100644index 0000000000..97f60a140e--- /dev/null+++ b/packages/docs/components/TextHighlightExamples.tsx@@ -0,0 +1,96 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Player} from '@remotion/player';+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const playerStyle: React.CSSProperties = {+ width: '100%',+ border: '1px solid var(--ifm-color-emphasis-300)',+ borderRadius: 'var(--ifm-pre-border-radius)',+ backgroundColor: 'white',+ marginBottom: 40,+};++const layout: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+ backgroundColor: 'white',+};++const RoughHighlightComposition: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={layout}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>The turning point was </Interactive.Span>+ <Highlight+ name="Rough highlight"+ progress={interpolate(frame, [0, 28], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color="rgba(255, 236, 79, 0.62)"+ roughness={2.3}+ maxRandomnessOffset={10}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ obvious+ </Highlight>+ <Interactive.Span>.</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};++export const TextHighlightRoughNotationDemo: React.FC = () => {+ return (+ <Player+ acknowledgeRemotionLicense+ component={RoughHighlightComposition}+ compositionWidth={1080}+ compositionHeight={500}+ durationInFrames={90}+ fps={30}+ autoPlay+ initiallyMuted+ loop+ style={playerStyle}+ />+ );+};diff --git a/packages/docs/components/demos/RoughNotationAnimatedSeedDemo.tsx b/packages/docs/components/demos/RoughNotationAnimatedSeedDemo.tsxnew file mode 100644index 0000000000..d929cfde7e--- /dev/null+++ b/packages/docs/components/demos/RoughNotationAnimatedSeedDemo.tsx@@ -0,0 +1,53 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationAnimatedSeedDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Animated seed annotation"+ progress={1}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ seed={interpolate(frame, [0, 89], [1, 90], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationBoxDemo.tsx b/packages/docs/components/demos/RoughNotationBoxDemo.tsxnew file mode 100644index 0000000000..c8a6f111cd--- /dev/null+++ b/packages/docs/components/demos/RoughNotationBoxDemo.tsx@@ -0,0 +1,60 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Box} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationBoxDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Interactive.Span>Think outside the </Interactive.Span>+ <Box+ name="Box annotation"+ progress={interpolate(frame, [0, 23], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#fe0000'}+ strokeWidth={8}+ iterations={1}+ padding={{+ left: 3,+ right: 6,+ top: -12,+ bottom: -5,+ }}+ roughness={0.9}+ >+ box+ </Box>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationBracketDemo.tsx b/packages/docs/components/demos/RoughNotationBracketDemo.tsxnew file mode 100644index 0000000000..259335fdc2--- /dev/null+++ b/packages/docs/components/demos/RoughNotationBracketDemo.tsx@@ -0,0 +1,61 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Bracket} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationBracketDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Mark </Interactive.Span>+ <Bracket+ name="Bracket annotation"+ progress={interpolate(frame, [0, 60], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ bracketLeft+ bracketRight+ bracketTop+ roughness={1}+ bowing={3}+ strokeWidth={8}+ color="#dc2626"+ bracketBottom+ padding={{+ top: -11,+ }}+ >+ this+ </Bracket>{' '}+ <Interactive.Span>part</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationCircleDemo.tsx b/packages/docs/components/demos/RoughNotationCircleDemo.tsxnew file mode 100644index 0000000000..d1432177d8--- /dev/null+++ b/packages/docs/components/demos/RoughNotationCircleDemo.tsx@@ -0,0 +1,62 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationCircleDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>How much </Interactive.Span>+ <Circle+ name="Circle annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],+ })}+ roughness={1.8}+ strokeWidth={12}+ color={'rgba(37, 99, 235, 0.57)'}+ padding={{+ left: 10,+ right: 10,+ top: 10,+ bottom: 10,+ }}+ box={'inside'}+ >+ circular+ </Circle>{' '}+ <Interactive.Span>financing is in AI?</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationCrossedOffDemo.tsx b/packages/docs/components/demos/RoughNotationCrossedOffDemo.tsxnew file mode 100644index 0000000000..f23e7fcfd4--- /dev/null+++ b/packages/docs/components/demos/RoughNotationCrossedOffDemo.tsx@@ -0,0 +1,54 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {CrossedOff} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationCrossedOffDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Please </Interactive.Span>+ <CrossedOff+ name="Crossed off annotation"+ progress={interpolate(frame, [18, 39], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#eb2525'}+ strokeWidth={6}+ iterations={10}+ roughness={2}+ >+ remove+ </CrossedOff>{' '}+ <Interactive.Span>this</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationHighlightDemo.tsx b/packages/docs/components/demos/RoughNotationHighlightDemo.tsxnew file mode 100644index 0000000000..bae83624ca--- /dev/null+++ b/packages/docs/components/demos/RoughNotationHighlightDemo.tsx@@ -0,0 +1,69 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationHighlightDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>A truly </Interactive.Span>+ <Highlight+ name="Highlight annotation"+ progress={interpolate(frame, [0, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color={'rgba(255, 236, 79, 0.62)'}+ maxRandomnessOffset={10}+ roughness={2.3}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ remarkable+ </Highlight>{' '}+ <Interactive.Span>end to the World cup</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationPosterizedProgressDemo.tsx b/packages/docs/components/demos/RoughNotationPosterizedProgressDemo.tsxnew file mode 100644index 0000000000..7d1de9d42d--- /dev/null+++ b/packages/docs/components/demos/RoughNotationPosterizedProgressDemo.tsx@@ -0,0 +1,54 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationPosterizedProgressDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Posterized progress annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 10,+ })}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ iterations={1}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationPosterizedSeedDemo.tsx b/packages/docs/components/demos/RoughNotationPosterizedSeedDemo.tsxnew file mode 100644index 0000000000..50f9503924--- /dev/null+++ b/packages/docs/components/demos/RoughNotationPosterizedSeedDemo.tsx@@ -0,0 +1,54 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationPosterizedSeedDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Posterized seed annotation"+ progress={1}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ seed={interpolate(frame, [0, 89], [1, 90], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 10,+ })}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationStrikeThroughDemo.tsx b/packages/docs/components/demos/RoughNotationStrikeThroughDemo.tsxnew file mode 100644index 0000000000..96bd1be874--- /dev/null+++ b/packages/docs/components/demos/RoughNotationStrikeThroughDemo.tsx@@ -0,0 +1,52 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {StrikeThrough} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationStrikeThroughDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>The </Interactive.Span>+ <StrikeThrough+ name="Strike-through annotation"+ progress={interpolate(frame, [10, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#f11515'}+ strokeWidth={14}+ >+ forbidden+ </StrikeThrough>{' '}+ <Interactive.Span>fruit</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/RoughNotationUnderlineDemo.tsx b/packages/docs/components/demos/RoughNotationUnderlineDemo.tsxnew file mode 100644index 0000000000..71bb0e2407--- /dev/null+++ b/packages/docs/components/demos/RoughNotationUnderlineDemo.tsx@@ -0,0 +1,53 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Underline} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationUnderlineDemo: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ }}+ >+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Underline </Interactive.Span>+ <Underline+ name="Underline annotation"+ progress={interpolate(frame, [14, 35], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'rgba(53, 95, 143, 0.71)'}+ strokeWidth={10}+ iterations={3}+ >+ this+ </Underline>{' '}+ <Interactive.Span>phrase</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/docs/components/demos/index.tsx b/packages/docs/components/demos/index.tsxindex a65b5c6d70..9fc0d082f0 100644--- a/packages/docs/components/demos/index.tsx+++ b/packages/docs/components/demos/index.tsx@@ -42,7 +42,17 @@ import {rectDemo,ripplePresentationDemo,rotateDemo,+ roughNotationAnimatedSeedDemo,+ roughNotationBoxDemo,+ roughNotationBracketDemo,+ roughNotationCircleDemo,+ roughNotationCrossedOffDemo,roundedTextBoxDemo,+ roughNotationHighlightDemo,+ roughNotationPosterizedProgressDemo,+ roughNotationPosterizedSeedDemo,+ roughNotationStrikeThroughDemo,+ roughNotationUnderlineDemo,scaleDemo,shaderDemo,skewDemo,@@ -140,6 +150,16 @@ const demos: DemoType[] = [springDampingDemo,shaderDemo,lightLeakDemo,+ roughNotationHighlightDemo,+ roughNotationUnderlineDemo,+ roughNotationStrikeThroughDemo,+ roughNotationCrossedOffDemo,+ roughNotationBoxDemo,+ roughNotationBracketDemo,+ roughNotationCircleDemo,+ roughNotationAnimatedSeedDemo,+ roughNotationPosterizedSeedDemo,+ roughNotationPosterizedProgressDemo,starburstDemo,transitionSeriesTransitionDemo,transitionSeriesOverlayDemo,diff --git a/packages/docs/components/demos/types.ts b/packages/docs/components/demos/types.tsindex b56bf9945e..c899f58d82 100644--- a/packages/docs/components/demos/types.ts+++ b/packages/docs/components/demos/types.ts@@ -33,6 +33,16 @@ import {PieDemo} from './Pie';import {PolygonDemo} from './Polygon';import {RectDemo} from './Rect';import {RippleDocsDemo} from './RippleDemo';+import {RoughNotationAnimatedSeedDemo} from './RoughNotationAnimatedSeedDemo';+import {RoughNotationBoxDemo} from './RoughNotationBoxDemo';+import {RoughNotationBracketDemo} from './RoughNotationBracketDemo';+import {RoughNotationCircleDemo} from './RoughNotationCircleDemo';+import {RoughNotationCrossedOffDemo} from './RoughNotationCrossedOffDemo';+import {RoughNotationHighlightDemo} from './RoughNotationHighlightDemo';+import {RoughNotationPosterizedProgressDemo} from './RoughNotationPosterizedProgressDemo';+import {RoughNotationPosterizedSeedDemo} from './RoughNotationPosterizedSeedDemo';+import {RoughNotationStrikeThroughDemo} from './RoughNotationStrikeThroughDemo';+import {RoughNotationUnderlineDemo} from './RoughNotationUnderlineDemo';import {RoundedTextBox} from './RoundedTextBox';import {ShaderDemoComp} from './ShaderDemo';import {SparkDemo} from './Spark';@@ -1398,6 +1408,136 @@ export const lightLeakDemo: DemoType = {],};+export const roughNotationHighlightDemo: DemoType = {+ comp: RoughNotationHighlightDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-highlight',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationUnderlineDemo: DemoType = {+ comp: RoughNotationUnderlineDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-underline',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationStrikeThroughDemo: DemoType = {+ comp: RoughNotationStrikeThroughDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-strike-through',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationCrossedOffDemo: DemoType = {+ comp: RoughNotationCrossedOffDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-crossed-off',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationBoxDemo: DemoType = {+ comp: RoughNotationBoxDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-box',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationBracketDemo: DemoType = {+ comp: RoughNotationBracketDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-bracket',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationCircleDemo: DemoType = {+ comp: RoughNotationCircleDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-circle',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationAnimatedSeedDemo: DemoType = {+ comp: RoughNotationAnimatedSeedDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-animated-seed',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationPosterizedSeedDemo: DemoType = {+ comp: RoughNotationPosterizedSeedDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-posterized-seed',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};++export const roughNotationPosterizedProgressDemo: DemoType = {+ comp: RoughNotationPosterizedProgressDemo,+ compHeight: 500,+ compWidth: 1080,+ durationInFrames: 90,+ fps: 30,+ id: 'rough-notation-posterized-progress',+ autoPlay: true,+ controls: true,+ logLevel: 'info',+ options: [],+};+export const starburstDemo: DemoType = {comp: StarburstDemoComp,compHeight: 720,diff --git a/packages/docs/docs/rough-notation/box.mdx b/packages/docs/docs/rough-notation/box.mdxnew file mode 100644index 0000000000..a9b0ef28aa--- /dev/null+++ b/packages/docs/docs/rough-notation/box.mdx@@ -0,0 +1,57 @@+---+image: /generated/articles-docs-rough-notation-box.png+title: '<Box>'+crumb: '@remotion/rough-notation'+---++# <Box><AvailableFrom v="4.0.490" />++Draws an animated hand-drawn box around the text or element it wraps.++## Example++<Demo type="rough-notation-box" />++```tsx twoslash title="MyComp.tsx"+import {Box} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <Box+ progress={1}+ color="#fe0000"+ strokeWidth={8}+ iterations={1}+ roughness={0.9}+ padding={{left: 3, right: 6, top: -12, bottom: -5}}+ >+ box+ </Box>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `7`.++### `iterations?`++The number of rough strokes to draw. Default: `2`.++### `padding?`++Insets or outsets for the box. Accepts `left`, `right`, `top` and `bottom`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<Bracket>`](/docs/rough-notation/bracket)diff --git a/packages/docs/docs/rough-notation/bracket.mdx b/packages/docs/docs/rough-notation/bracket.mdxnew file mode 100644index 0000000000..491c376fd9--- /dev/null+++ b/packages/docs/docs/rough-notation/bracket.mdx@@ -0,0 +1,73 @@+---+image: /generated/articles-docs-rough-notation-bracket.png+title: '<Bracket>'+crumb: '@remotion/rough-notation'+---++# <Bracket><AvailableFrom v="4.0.490" />++Draws animated hand-drawn brackets around the text or element it wraps.++## Example++<Demo type="rough-notation-bracket" />++```tsx twoslash title="MyComp.tsx"+import {Bracket} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <Bracket+ progress={1}+ color="#dc2626"+ strokeWidth={8}+ roughness={1}+ bowing={3}+ bracketLeft+ bracketRight+ bracketTop+ bracketBottom+ padding={{top: -11}}+ >+ this+ </Bracket>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `20`.++### `padding?`++Insets or outsets for the complete bracket. Accepts `left`, `right`, `top` and `bottom`.++### `bracketLeft?`++Draws the left bracket. Default: `false`.++### `bracketRight?`++Draws the right bracket. Default: `true`.++### `bracketTop?`++Draws the top bracket. Default: `false`.++### `bracketBottom?`++Draws the bottom bracket. Default: `false`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<Box>`](/docs/rough-notation/box)diff --git a/packages/docs/docs/rough-notation/circle.mdx b/packages/docs/docs/rough-notation/circle.mdxnew file mode 100644index 0000000000..14c0cb237c--- /dev/null+++ b/packages/docs/docs/rough-notation/circle.mdx@@ -0,0 +1,73 @@+---+image: /generated/articles-docs-rough-notation-circle.png+title: '<Circle>'+crumb: '@remotion/rough-notation'+---++# <Circle><AvailableFrom v="4.0.490" />++Draws an animated hand-drawn circle around the text or element it wraps.++## Example++<Demo type="rough-notation-circle" />++```tsx twoslash title="MyComp.tsx"+import {Circle} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <Circle+ progress={1}+ color="rgba(37, 99, 235, 0.57)"+ strokeWidth={12}+ roughness={1.8}+ padding={{left: 10, right: 10, top: 10, bottom: 10}}+ box="inside"+ >+ circular+ </Circle>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `20`.++### `iterations?`++The number of rough strokes to draw. Each iteration gets a different seed. Default: `2`.++### `padding?`++Insets or outsets for the circle. Accepts `left`, `right`, `top` and `bottom`.++### `box?`++Set to `around` to circle the element bounds or `inside` to fit the ellipse inside the padded box. Default: `around`.++### `curveFitting?`++Controls how closely the curve fits its points. Default: `0.95`.++### `curveTightness?`++Controls the curve tightness. Default: `0`.++### `curveStepCount?`++Controls how many steps approximate the curve. Default: `9`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<Highlight>`](/docs/rough-notation/highlight)diff --git a/packages/docs/docs/rough-notation/crossed-off.mdx b/packages/docs/docs/rough-notation/crossed-off.mdxnew file mode 100644index 0000000000..b32141c65d--- /dev/null+++ b/packages/docs/docs/rough-notation/crossed-off.mdx@@ -0,0 +1,56 @@+---+image: /generated/articles-docs-rough-notation-crossed-off.png+title: '<CrossedOff>'+crumb: '@remotion/rough-notation'+---++# <CrossedOff><AvailableFrom v="4.0.490" />++Draws two animated crossing strokes over the text or element it wraps.++## Example++<Demo type="rough-notation-crossed-off" />++```tsx twoslash title="MyComp.tsx"+import {CrossedOff} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <CrossedOff+ progress={1}+ color="#eb2525"+ strokeWidth={6}+ iterations={10}+ roughness={2}+ >+ remove+ </CrossedOff>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `20`.++### `iterations?`++The number of rough strokes to draw for each diagonal. Default: `1`.++### `rtl?`++Draws the strokes right-to-left. Default: `false`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<StrikeThrough>`](/docs/rough-notation/strike-through)diff --git a/packages/docs/docs/rough-notation/highlight.mdx b/packages/docs/docs/rough-notation/highlight.mdxnew file mode 100644index 0000000000..e2d977e1f4--- /dev/null+++ b/packages/docs/docs/rough-notation/highlight.mdx@@ -0,0 +1,112 @@+---+image: /generated/articles-docs-rough-notation-highlight.png+title: '<Highlight>'+crumb: '@remotion/rough-notation'+---++# <Highlight><AvailableFrom v="4.0.490" />++Draws an animated marker highlight behind the text or element it wraps.++## Example++<Demo type="rough-notation-highlight" />++```tsx twoslash title="RoughNotationHighlight.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const RoughNotationHighlight: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill+ style={{+ justifyContent: 'center',+ alignItems: 'center',+ backgroundColor: '#f5f6f7',+ }}+ >+ <Interactive.Div+ name="Container"+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>A truly </Interactive.Span>+ <Highlight+ name="Highlight annotation"+ progress={interpolate(frame, [0, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color="rgba(255, 236, 79, 0.62)"+ maxRandomnessOffset={10}+ roughness={2.3}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ remarkable+ </Highlight>{' '}+ <Interactive.Span>end to the World cup</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++## API++### `iterations?`++Number of marker strokes to draw. Default: `2`.++### `padding?`++Insets or outsets for the highlight. Accepts `left`, `right`, `top` and `bottom`.++### `rtl?`++Draws the highlight right-to-left. Default: `false`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<Circle>`](/docs/rough-notation/circle)diff --git a/packages/docs/docs/rough-notation/index.mdx b/packages/docs/docs/rough-notation/index.mdxnew file mode 100644index 0000000000..f73c0681aa--- /dev/null+++ b/packages/docs/docs/rough-notation/index.mdx@@ -0,0 +1,72 @@+---+image: /generated/articles-docs-rough-notation-index.png+id: rough-notation-api+slug: /rough-notation/api+title: '@remotion/rough-notation'+---++# @remotion/rough-notation<AvailableFrom v="4.0.490" />++Animated marker highlights, circles, boxes, underlines and other hand-drawn text annotations for Remotion videos.++import {TableOfContents} from './table-of-contents';++<Installation pkg="@remotion/rough-notation" />++## APIs++<TableOfContents />++## Common props++Every component wraps the text or element passed as `children` and accepts these props:++### `children`++The text or element to annotate.++### `style?`++CSS styles applied to the tracked content. Text and font styles can also be edited in Remotion Studio.++### `progress`++Controls how much of the annotation is drawn. Use a value between `0` and `1`.++### `disabled?`++Set to `true` to temporarily hide the annotation while keeping the component and its other props in place. Default: `false`.++### `seed?`++Controls the generated shape. Change the integer on every frame to animate the shape. Default: `1`.++### `color?`++The annotation color. Default: `currentColor`.++### `roughness?`++Controls how rough the annotation looks. The default is `3` for `<Highlight>` and `1.5` for the other components.++### `maxRandomnessOffset?`++Controls how far points may be randomly offset from their ideal position. Default: `5`.++### `bowing?`++Controls how much straight lines bow. Default: `1`.++### `disableMultiStroke?`++Set to `true` to prevent Rough.js from drawing multiple strokes for a line. Default: `false`.++### `preserveVertices?`++Preserves vertices when roughening a shape. Default: `false`.++The components are interactive in Remotion Studio. They support editable text and font controls, as well as the following [`<Sequence>`](/docs/sequence) props: `durationInFrames`, `from`, `trimBefore`, `freeze`, `hidden`, `name` and `showInTimeline`.++## License++MITdiff --git a/packages/docs/docs/rough-notation/strike-through.mdx b/packages/docs/docs/rough-notation/strike-through.mdxnew file mode 100644index 0000000000..3d99cbe975--- /dev/null+++ b/packages/docs/docs/rough-notation/strike-through.mdx@@ -0,0 +1,50 @@+---+image: /generated/articles-docs-rough-notation-strike-through.png+title: '<StrikeThrough>'+crumb: '@remotion/rough-notation'+---++# <StrikeThrough><AvailableFrom v="4.0.490" />++Draws an animated hand-drawn line through the text or element it wraps.++## Example++<Demo type="rough-notation-strike-through" />++```tsx twoslash title="MyComp.tsx"+import {StrikeThrough} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <StrikeThrough progress={1} color="#f11515" strokeWidth={14}>+ forbidden+ </StrikeThrough>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `20`.++### `iterations?`++The number of rough strokes to draw. Default: `1`.++### `rtl?`++Draws the line right-to-left. Default: `false`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<CrossedOff>`](/docs/rough-notation/crossed-off)diff --git a/packages/docs/docs/rough-notation/table-of-contents.tsx b/packages/docs/docs/rough-notation/table-of-contents.tsxnew file mode 100644index 0000000000..65514d8ac7--- /dev/null+++ b/packages/docs/docs/rough-notation/table-of-contents.tsx@@ -0,0 +1,40 @@+import React from 'react';+import {Grid} from '../../components/TableOfContents/Grid';+import {TOCItem} from '../../components/TableOfContents/TOCItem';++export const TableOfContents: React.FC = () => {+ return (+ <div>+ <Grid>+ <TOCItem link="/docs/rough-notation/box">+ <strong>{'<Box>'}</strong>+ <div>Draw a box around text</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/bracket">+ <strong>{'<Bracket>'}</strong>+ <div>Draw brackets beside text</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/circle">+ <strong>{'<Circle>'}</strong>+ <div>Circle text</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/crossed-off">+ <strong>{'<CrossedOff>'}</strong>+ <div>Cross off text with two strokes</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/highlight">+ <strong>{'<Highlight>'}</strong>+ <div>Draw a marker highlight behind text</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/strike-through">+ <strong>{'<StrikeThrough>'}</strong>+ <div>Strike through text with one line</div>+ </TOCItem>+ <TOCItem link="/docs/rough-notation/underline">+ <strong>{'<Underline>'}</strong>+ <div>Underline text</div>+ </TOCItem>+ </Grid>+ </div>+ );+};diff --git a/packages/docs/docs/rough-notation/underline.mdx b/packages/docs/docs/rough-notation/underline.mdxnew file mode 100644index 0000000000..c5c8ab8462--- /dev/null+++ b/packages/docs/docs/rough-notation/underline.mdx@@ -0,0 +1,59 @@+---+image: /generated/articles-docs-rough-notation-underline.png+title: '<Underline>'+crumb: '@remotion/rough-notation'+---++# <Underline><AvailableFrom v="4.0.490" />++Draws an animated hand-drawn underline below the text or element it wraps.++## Example++<Demo type="rough-notation-underline" />++```tsx twoslash title="MyComp.tsx"+import {Underline} from '@remotion/rough-notation';++export const MyComp: React.FC = () => {+ return (+ <Underline+ progress={1}+ color="rgba(53, 95, 143, 0.71)"+ strokeWidth={10}+ iterations={3}+ >+ this+ </Underline>+ );+};+```++## API++### `strokeWidth?`++The stroke width in pixels. Default: `20`.++### `iterations?`++The number of rough strokes to draw. Default: `2`.++### `padding?`++Accepts a `top` value to move the underline down from the text.++### `rtl?`++Draws the underline right-to-left. Default: `false`.++Also accepts the [common annotation props](/docs/rough-notation/api#common-props).++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [Text highlights](/docs/text-highlights)+- [`<Highlight>`](/docs/rough-notation/highlight)diff --git a/packages/docs/docs/studio/make-component-interactive.mdx b/packages/docs/docs/studio/make-component-interactive.mdxindex c5214adcd0..13eb192f2b 100644--- a/packages/docs/docs/studio/make-component-interactive.mdx+++ b/packages/docs/docs/studio/make-component-interactive.mdx@@ -157,6 +157,7 @@ Use a stable `componentIdentity` so saved Studio edits can be associated with th```tsx twoslash title="Badge.tsx"import React, {forwardRef, useImperativeHandle, useRef} from 'react';import {+ Internals,Interactive,Sequence,type InteractiveBaseProps,@@ -246,8 +247,12 @@ export const Badge = Interactive.withSchema({schema: badgeSchema,supportsEffects: false,});++Internals.addSequenceStackTraces(Badge);```+Registering stack traces is currently an internal step. It lets the Studio find the JSX element where `<Badge>` is used, instead of the internal `<Sequence>` rendered by `BadgeInner`.+## Use the component```tsx title="MyComp.tsx"diff --git a/packages/docs/docs/text-highlights.mdx b/packages/docs/docs/text-highlights.mdxnew file mode 100644index 0000000000..030571782c--- /dev/null+++ b/packages/docs/docs/text-highlights.mdx@@ -0,0 +1,735 @@+---+image: /generated/articles-docs-text-highlights.png+id: text-highlights+title: Text highlights+crumb: 'Designing visuals'+---++# Text highlights++We recommend [`@remotion/rough-notation`](/docs/rough-notation/api) to annotate text to add marker highlights, encircle words, box or strike through parts.++## Highlight++Use [`<Highlight>`](/docs/rough-notation/highlight) from [`@remotion/rough-notation`](/docs/rough-notation/api) for a hand-drawn highlight behind text.++<Demo type="rough-notation-highlight" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationHighlight.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationHighlight: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>A truly </Interactive.Span>+ <Highlight+ name="Highlight annotation"+ progress={interpolate(frame, [0, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color={'rgba(255, 236, 79, 0.62)'}+ maxRandomnessOffset={10}+ roughness={2.3}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ remarkable+ </Highlight>{' '}+ <Interactive.Span>end to the World cup</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Underline++Use [`<Underline>`](/docs/rough-notation/underline) to add a drawn underline.++<Demo type="rough-notation-underline" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationUnderline.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Underline} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationUnderline: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Underline </Interactive.Span>+ <Underline+ name="Underline annotation"+ progress={interpolate(frame, [14, 35], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'rgba(53, 95, 143, 0.71)'}+ strokeWidth={10}+ iterations={3}+ >+ this+ </Underline>{' '}+ <Interactive.Span>phrase</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Strike-through++Use [`<StrikeThrough>`](/docs/rough-notation/strike-through) to cross out a word with a single line.++<Demo type="rough-notation-strike-through" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationStrikeThrough.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {StrikeThrough} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationStrikeThrough: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>The </Interactive.Span>+ <StrikeThrough+ name="Strike-through annotation"+ progress={interpolate(frame, [10, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#f11515'}+ strokeWidth={14}+ >+ forbidden+ </StrikeThrough>{' '}+ <Interactive.Span>fruit</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Crossed-off++Use [`<CrossedOff>`](/docs/rough-notation/crossed-off) for a stronger removal mark.++<Demo type="rough-notation-crossed-off" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationCrossedOff.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {CrossedOff} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationCrossedOff: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Please </Interactive.Span>+ <CrossedOff+ name="Crossed off annotation"+ progress={interpolate(frame, [18, 39], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#eb2525'}+ strokeWidth={6}+ iterations={10}+ roughness={2}+ >+ remove+ </CrossedOff>{' '}+ <Interactive.Span>this</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Box++Use [`<Box>`](/docs/rough-notation/box) to draw a rectangle around text.++<Demo type="rough-notation-box" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationBox.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Box} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationBox: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Interactive.Span>Think outside the </Interactive.Span>+ <Box+ name="Box annotation"+ progress={interpolate(frame, [0, 23], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#fe0000'}+ strokeWidth={8}+ iterations={1}+ padding={{+ left: 3,+ right: 6,+ top: -12,+ bottom: -5,+ }}+ roughness={0.9}+ >+ box+ </Box>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Bracket++Use [`<Bracket>`](/docs/rough-notation/bracket) with individual bracket flags to draw selected sides.++<Demo type="rough-notation-bracket" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationBracket.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Bracket} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationBracket: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Mark </Interactive.Span>+ <Bracket+ name="Bracket annotation"+ progress={interpolate(frame, [0, 60], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ bracketLeft+ bracketRight+ bracketTop+ roughness={1}+ bowing={3}+ strokeWidth={8}+ color="#dc2626"+ bracketBottom+ padding={{+ top: -11,+ }}+ >+ this+ </Bracket>{' '}+ <Interactive.Span>part</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Circle marker++Use [`<Circle>`](/docs/rough-notation/circle) when the annotation should sit above the text.++<Demo type="rough-notation-circle" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationCircle.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationCircle: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>How much </Interactive.Span>+ <Circle+ name="Circle annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],+ })}+ roughness={1.8}+ strokeWidth={12}+ color={'rgba(37, 99, 235, 0.57)'}+ padding={{+ left: 10,+ right: 10,+ top: 10,+ bottom: 10,+ }}+ box={'inside'}+ >+ circular+ </Circle>{' '}+ <Interactive.Span>financing is in AI?</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Animating the seed++Animate [`seed`](/docs/rough-notation/api#seed) to redraw an annotation on every frame.++<Demo type="rough-notation-animated-seed" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationAnimatedSeed.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationAnimatedSeed: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Animated seed annotation"+ progress={1}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ seed={interpolate(frame, [0, 89], [1, 90], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++### Posterized seed++Add [`posterize`](/docs/interpolate#posterize) to [`interpolate`](/docs/interpolate) to lower the frame rate of the seed change.++<Demo type="rough-notation-posterized-seed" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationPosterizedSeed.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationPosterizedSeed: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Posterized seed annotation"+ progress={1}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ seed={interpolate(frame, [0, 89], [1, 90], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 10,+ })}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## Posterizing the progress++Apply [`posterize`](/docs/interpolate#posterize) to `progress` to make the circle draw in discrete steps.++<Demo type="rough-notation-posterized-progress" />++<details>+<summary>Show code</summary>++```tsx twoslash title="RoughNotationPosterizedProgress.tsx"+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};++export const RoughNotationPosterizedProgress: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Circle+ name="Posterized progress annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 10,+ })}+ color={'#2563eb'}+ strokeWidth={10}+ roughness={1.8}+ iterations={1}+ >+ motion+ </Circle>+ </Interactive.Div>+ </AbsoluteFill>+ );+};+```++</details>++## See also++- [`@remotion/rough-notation`](/docs/rough-notation/api)+- [`<Box>`](/docs/rough-notation/box)+- [`<Bracket>`](/docs/rough-notation/bracket)+- [`<Circle>`](/docs/rough-notation/circle)+- [`<CrossedOff>`](/docs/rough-notation/crossed-off)+- [`<Highlight>`](/docs/rough-notation/highlight)+- [`<StrikeThrough>`](/docs/rough-notation/strike-through)+- [`<Underline>`](/docs/rough-notation/underline)+- [`interpolate()`](/docs/interpolate)+- [Fonts](/docs/fonts)diff --git a/packages/docs/elements-sidebars.ts b/packages/docs/elements-sidebars.tsindex 92d3a6fc53..1601ff87b1 100644--- a/packages/docs/elements-sidebars.ts+++ b/packages/docs/elements-sidebars.ts@@ -21,6 +21,13 @@ const sidebars: SidebarsConfig = {'backgrounds/rotating-starburst/index',],},+ {+ type: 'category',+ label: 'Data',+ link: {type: 'doc', id: 'data/index'},+ collapsed: false,+ items: ['data/number-counter/index'],+ },{type: 'category',label: 'Overlays',@@ -30,10 +37,15 @@ const sidebars: SidebarsConfig = {},{type: 'category',- label: 'Data',- link: {type: 'doc', id: 'data/index'},+ label: 'Text',+ link: {type: 'doc', id: 'text/index'},collapsed: false,- items: ['data/number-counter/index'],+ items: [+ 'text/circle-marker/index',+ 'text/crossed-off/index',+ 'text/strike-through/index',+ 'text/text-marker/index',+ ],},],};diff --git a/packages/docs/elements/text/circle-marker/circle-marker.tsx b/packages/docs/elements/text/circle-marker/circle-marker.tsxnew file mode 100644index 0000000000..9bd004511c--- /dev/null+++ b/packages/docs/elements/text/circle-marker/circle-marker.tsx@@ -0,0 +1,56 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {Easing, Interactive, interpolate, useCurrentFrame} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const CircleMarker: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Interactive.Div+ name="Container"+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>How much </Interactive.Span>+ <Circle+ name="Circle annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],+ posterize: 4,+ })}+ seed={interpolate(frame, [0, 89], [1, 90], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 4,+ })}+ roughness={1.8}+ strokeWidth={12}+ color="#2563eb"+ padding={{+ left: 10,+ right: 10,+ top: 10,+ bottom: 10,+ }}+ box="inside"+ >+ circular+ </Circle>{' '}+ <Interactive.Span>financing is in AI?</Interactive.Span>+ </Interactive.Div>+ );+};diff --git a/packages/docs/elements/text/circle-marker/index.mdx b/packages/docs/elements/text/circle-marker/index.mdxnew file mode 100644index 0000000000..5ababee34d--- /dev/null+++ b/packages/docs/elements/text/circle-marker/index.mdx@@ -0,0 +1,11 @@+---+title: Circle Marker+description: An animated hand-drawn circle around text.+---++import {ElementPage} from '@site/src/components/Elements/ElementPage';+import {CircleMarker} from './circle-marker';++# Circle Marker++<ElementPage component={CircleMarker} description="An animated hand-drawn circle with posterized drawing progress and shape changes." displayName="Circle Marker" elementHeight={220} elementWidth={900} previewPadding={120} slug="text/circle-marker" sourceFile="./circle-marker.tsx" />diff --git a/packages/docs/elements/text/crossed-off/crossed-off.tsx b/packages/docs/elements/text/crossed-off/crossed-off.tsxnew file mode 100644index 0000000000..70dae44989--- /dev/null+++ b/packages/docs/elements/text/crossed-off/crossed-off.tsx@@ -0,0 +1,48 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {CrossedOff} from '@remotion/rough-notation';+import React from 'react';+import {Interactive, interpolate, useCurrentFrame} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const CrossedOffText: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Interactive.Div+ name="Container"+ style={{+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ height: '100%',+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ }}+ >+ <div>+ <Interactive.Span>Please </Interactive.Span>+ <CrossedOff+ name="Crossed off annotation"+ progress={interpolate(frame, [18, 39], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color="#eb2525"+ strokeWidth={6}+ iterations={10}+ roughness={2}+ >+ remove+ </CrossedOff>{' '}+ <Interactive.Span>this</Interactive.Span>+ </div>+ </Interactive.Div>+ );+};diff --git a/packages/docs/elements/text/crossed-off/index.mdx b/packages/docs/elements/text/crossed-off/index.mdxnew file mode 100644index 0000000000..6cd8b1333b--- /dev/null+++ b/packages/docs/elements/text/crossed-off/index.mdx@@ -0,0 +1,11 @@+---+title: Crossed Off+description: Animated hand-drawn crossed-off text.+---++import {ElementPage} from '@site/src/components/Elements/ElementPage';+import {CrossedOffText} from './crossed-off';++# Crossed Off++<ElementPage component={CrossedOffText} description="An animated hand-drawn cross for removing a word or phrase with emphasis." displayName="Crossed Off" elementHeight={220} elementWidth={900} previewPadding={120} slug="text/crossed-off" sourceFile="./crossed-off.tsx" />diff --git a/packages/docs/elements/text/index.mdx b/packages/docs/elements/text/index.mdxnew file mode 100644index 0000000000..6d473e3472--- /dev/null+++ b/packages/docs/elements/text/index.mdx@@ -0,0 +1,13 @@+---+title: Text+description: Drop-in text Elements for Remotion videos.+---++# Text++Elements:++- [Circle Marker](/elements/text/circle-marker/)+- [Crossed Off](/elements/text/crossed-off/)+- [Strike Through](/elements/text/strike-through/)+- [Text Marker](/elements/text/text-marker/)diff --git a/packages/docs/elements/text/strike-through/index.mdx b/packages/docs/elements/text/strike-through/index.mdxnew file mode 100644index 0000000000..ea0a8b3cf7--- /dev/null+++ b/packages/docs/elements/text/strike-through/index.mdx@@ -0,0 +1,11 @@+---+title: Strike Through+description: Animated hand-drawn strike-through text.+---++import {ElementPage} from '@site/src/components/Elements/ElementPage';+import {StrikeThroughText} from './strike-through';++# Strike Through++<ElementPage component={StrikeThroughText} description="An animated hand-drawn line for striking through a word or phrase." displayName="Strike Through" elementHeight={220} elementWidth={900} previewPadding={120} slug="text/strike-through" sourceFile="./strike-through.tsx" />diff --git a/packages/docs/elements/text/strike-through/strike-through.tsx b/packages/docs/elements/text/strike-through/strike-through.tsxnew file mode 100644index 0000000000..88e107a36e--- /dev/null+++ b/packages/docs/elements/text/strike-through/strike-through.tsx@@ -0,0 +1,46 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {StrikeThrough} from '@remotion/rough-notation';+import React from 'react';+import {Interactive, interpolate, useCurrentFrame} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const StrikeThroughText: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Interactive.Div+ name="Container"+ style={{+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ height: '100%',+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ }}+ >+ <div>+ <Interactive.Span>The </Interactive.Span>+ <StrikeThrough+ name="Strike-through annotation"+ progress={interpolate(frame, [10, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color="#f11515"+ strokeWidth={14}+ >+ forbidden+ </StrikeThrough>{' '}+ <Interactive.Span>fruit</Interactive.Span>+ </div>+ </Interactive.Div>+ );+};diff --git a/packages/docs/elements/text/text-marker/index.mdx b/packages/docs/elements/text/text-marker/index.mdxnew file mode 100644index 0000000000..48c7e33f9b--- /dev/null+++ b/packages/docs/elements/text/text-marker/index.mdx@@ -0,0 +1,11 @@+---+title: Text Marker+description: A hand-drawn animated text highlight.+---++import {ElementPage} from '@site/src/components/Elements/ElementPage';+import {TextMarker} from './text-marker';++# Text Marker++<ElementPage component={TextMarker} description="A hand-drawn animated text marker for calling attention to one phrase." displayName="Text Marker" elementHeight={220} elementWidth={900} previewPadding={120} slug="text/text-marker" sourceFile="./text-marker.tsx" />diff --git a/packages/docs/elements/text/text-marker/text-marker.tsx b/packages/docs/elements/text/text-marker/text-marker.tsxnew file mode 100644index 0000000000..209dd4e8e1--- /dev/null+++ b/packages/docs/elements/text/text-marker/text-marker.tsx@@ -0,0 +1,57 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {Easing, Interactive, interpolate, useCurrentFrame} from 'remotion';++const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const TextMarker: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Interactive.Div+ name="Container"+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>A truly </Interactive.Span>+ <Highlight+ name="Highlight annotation"+ progress={interpolate(frame, [0, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color="rgba(255, 236, 79, 0.62)"+ maxRandomnessOffset={10}+ roughness={2.3}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ remarkable+ </Highlight>{' '}+ <Interactive.Span>end to the World cup</Interactive.Span>+ </Interactive.Div>+ );+};diff --git a/packages/docs/package.json b/packages/docs/package.jsonindex 180ba9b10e..37386e7484 100644--- a/packages/docs/package.json+++ b/packages/docs/package.json@@ -60,6 +60,7 @@"@remotion/layout-utils": "workspace:*","@remotion/licensing": "workspace:*","@remotion/light-leaks": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/lottie": "workspace:*","@remotion/media": "workspace:*","@remotion/media-parser": "workspace:*",diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex 28b69b841b..46bb4802b2 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -653,6 +653,23 @@ const sidebars: SidebarsConfig = {},items: ['rive/index', 'rive/remotionrivecanvas'],},+ {+ type: 'category',+ label: '@remotion/rough-notation',+ link: {+ type: 'doc',+ id: 'rough-notation/rough-notation-api',+ },+ items: [+ 'rough-notation/box',+ 'rough-notation/bracket',+ 'rough-notation/circle',+ 'rough-notation/crossed-off',+ 'rough-notation/highlight',+ 'rough-notation/strike-through',+ 'rough-notation/underline',+ ],+ },{type: 'category',label: '@remotion/rounded-text-box',@@ -1035,21 +1052,22 @@ const sidebars: SidebarsConfig = {type: 'category',label: 'Designing visuals',items: [+ 'layers','transforms','assets',- 'layers',+ 'fonts','transitioning',+ 'html-in-canvas',+ 'shaders','effects',- 'fonts','measuring','using-randomness',- 'maps','animation-math','posterization',- 'html-in-canvas','noise-visualization',- 'shaders',+ 'maps','light-leaks',+ 'text-highlights','starburst',],},diff --git a/packages/docs/src/components/Elements/ElementPreview.tsx b/packages/docs/src/components/Elements/ElementPreview.tsxindex a6949cdcce..6ee532db70 100644--- a/packages/docs/src/components/Elements/ElementPreview.tsx+++ b/packages/docs/src/components/Elements/ElementPreview.tsx@@ -19,7 +19,7 @@ export const ElementPreview: React.FC<ElementPreviewProps> = ({return (<divstyle={{- backgroundColor: 'var(--ifm-color-emphasis-100)',+ backgroundColor: '#f5f6f7',overflow: 'hidden',}}>diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex 5eb19edc80..4567fc38ad 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -5833,6 +5833,78 @@ export const articles = [noAi: false,slug: 'rive/remotionrivecanvas',},+ {+ id: 'rough-notation/box',+ title: '<Box>',+ relativePath: 'docs/rough-notation/box.mdx',+ compId: 'articles-docs-rough-notation-box',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/box',+ },+ {+ id: 'rough-notation/bracket',+ title: '<Bracket>',+ relativePath: 'docs/rough-notation/bracket.mdx',+ compId: 'articles-docs-rough-notation-bracket',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/bracket',+ },+ {+ id: 'rough-notation/circle',+ title: '<Circle>',+ relativePath: 'docs/rough-notation/circle.mdx',+ compId: 'articles-docs-rough-notation-circle',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/circle',+ },+ {+ id: 'rough-notation/crossed-off',+ title: '<CrossedOff>',+ relativePath: 'docs/rough-notation/crossed-off.mdx',+ compId: 'articles-docs-rough-notation-crossed-off',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/crossed-off',+ },+ {+ id: 'rough-notation/highlight',+ title: '<Highlight>',+ relativePath: 'docs/rough-notation/highlight.mdx',+ compId: 'articles-docs-rough-notation-highlight',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/highlight',+ },+ {+ id: 'rough-notation-api',+ title: '@remotion/rough-notation',+ relativePath: 'docs/rough-notation/index.mdx',+ compId: 'articles-docs-rough-notation-index',+ crumb: null,+ noAi: false,+ slug: 'rough-notation/api',+ },+ {+ id: 'rough-notation/strike-through',+ title: '<StrikeThrough>',+ relativePath: 'docs/rough-notation/strike-through.mdx',+ compId: 'articles-docs-rough-notation-strike-through',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/strike-through',+ },+ {+ id: 'rough-notation/underline',+ title: '<Underline>',+ relativePath: 'docs/rough-notation/underline.mdx',+ compId: 'articles-docs-rough-notation-underline',+ crumb: '@remotion/rough-notation',+ noAi: false,+ slug: 'rough-notation/underline',+ },{id: 'rounded-text-box/create-rounded-text-box',title: 'createRoundedTextBox()',@@ -7066,6 +7138,15 @@ export const articles = [noAi: false,slug: 'testing',},+ {+ id: 'text-highlights',+ title: 'Text highlights',+ relativePath: 'docs/text-highlights.mdx',+ compId: 'articles-docs-text-highlights',+ crumb: 'Designing visuals',+ noAi: false,+ slug: 'text-highlights',+ },{id: 'the-fundamentals',title: 'The fundamentals',diff --git a/packages/docs/static/generated/articles-docs-rough-notation-box.png b/packages/docs/static/generated/articles-docs-rough-notation-box.pngnew file mode 100644index 0000000000..29ee17bfbaBinary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-box.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-bracket.png b/packages/docs/static/generated/articles-docs-rough-notation-bracket.pngnew file mode 100644index 0000000000..ffe3c5ea70Binary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-bracket.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-circle.png b/packages/docs/static/generated/articles-docs-rough-notation-circle.pngnew file mode 100644index 0000000000..a201a2077aBinary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-circle.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-crossed-off.png b/packages/docs/static/generated/articles-docs-rough-notation-crossed-off.pngnew file mode 100644index 0000000000..47fa470b82Binary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-crossed-off.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-highlight.png b/packages/docs/static/generated/articles-docs-rough-notation-highlight.pngnew file mode 100644index 0000000000..790c977b16Binary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-highlight.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-index.png b/packages/docs/static/generated/articles-docs-rough-notation-index.pngnew file mode 100644index 0000000000..c23e96e15bBinary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-index.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-strike-through.png b/packages/docs/static/generated/articles-docs-rough-notation-strike-through.pngnew file mode 100644index 0000000000..c743b5498fBinary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-strike-through.png differdiff --git a/packages/docs/static/generated/articles-docs-rough-notation-underline.png b/packages/docs/static/generated/articles-docs-rough-notation-underline.pngnew file mode 100644index 0000000000..e50a19b25dBinary files /dev/null and b/packages/docs/static/generated/articles-docs-rough-notation-underline.png differdiff --git a/packages/docs/static/generated/articles-docs-text-highlights.png b/packages/docs/static/generated/articles-docs-text-highlights.pngnew file mode 100644index 0000000000..b42db2fb4eBinary files /dev/null and b/packages/docs/static/generated/articles-docs-text-highlights.png differdiff --git a/packages/example/package.json b/packages/example/package.jsonindex 582ab8daab..f803f470b8 100644--- a/packages/example/package.json+++ b/packages/example/package.json@@ -56,6 +56,7 @@"@remotion/lambda-client": "workspace:*","@remotion/layout-utils": "workspace:*","@remotion/light-leaks": "workspace:*",+ "@remotion/rough-notation": "workspace:*","@remotion/starburst": "workspace:*","@remotion/lottie": "workspace:*","@remotion/media": "workspace:*",diff --git a/packages/example/src/Root.tsx b/packages/example/src/Root.tsxindex 37575d3db2..3ab5b8e6e7 100644--- a/packages/example/src/Root.tsx+++ b/packages/example/src/Root.tsx@@ -236,6 +236,15 @@ import {ProResMediaVideo,calculateProResMediaVideoMetadata,} from './ProResMediaVideo';+import {+ RoughNotationBracket,+ RoughNotationBox,+ RoughNotationCircle,+ RoughNotationCrossedOff,+ RoughNotationHighlight,+ RoughNotationStrikeThrough,+ RoughNotationUnderline,+} from './RoughNotation';import {SfxExample} from './Sfx';import {CanvasImg} from './SimpleImg/CanvasImg';import {ImgEffects} from './SimpleImg/ImgEffects';@@ -2537,6 +2546,64 @@ export const Index: React.FC = () => {durationInFrames={120}/></Folder>+ <Folder name="rough-notation">+ <Composition+ id="rough-notation-highlight"+ component={RoughNotationHighlight}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-box"+ component={RoughNotationBox}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-circle"+ component={RoughNotationCircle}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-bracket"+ component={RoughNotationBracket}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-crossed-off"+ component={RoughNotationCrossedOff}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-strike-through"+ component={RoughNotationStrikeThrough}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ <Composition+ id="rough-notation-underline"+ component={RoughNotationUnderline}+ width={1080}+ height={500}+ fps={30}+ durationInFrames={90}+ />+ </Folder><Folder name="starburst"><Compositionid="starburst"diff --git a/packages/example/src/RoughNotation/Box.tsx b/packages/example/src/RoughNotation/Box.tsxnew file mode 100644index 0000000000..510deca5c8--- /dev/null+++ b/packages/example/src/RoughNotation/Box.tsx@@ -0,0 +1,50 @@+import {Box} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationBox: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ textAlign: 'center',+ }}+ >+ <Interactive.Span>Think outside the </Interactive.Span>+ <Box+ name="Box annotation"+ progress={interpolate(frame, [0, 23], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#fe0000'}+ strokeWidth={8}+ iterations={1}+ padding={{+ left: 3,+ right: 6,+ top: -12,+ bottom: -5,+ }}+ roughness={0.9}+ >+ box+ </Box>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/Bracket.tsx b/packages/example/src/RoughNotation/Bracket.tsxnew file mode 100644index 0000000000..dacd0cc1c3--- /dev/null+++ b/packages/example/src/RoughNotation/Bracket.tsx@@ -0,0 +1,51 @@+import {Bracket} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationBracket: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Mark </Interactive.Span>+ <Bracket+ name="Bracket annotation"+ progress={interpolate(frame, [0, 60], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ bracketLeft+ bracketRight+ bracketTop+ roughness={1}+ bowing={3}+ strokeWidth={8}+ color="#dc2626"+ bracketBottom+ padding={{+ top: -11,+ }}+ >+ this+ </Bracket>{' '}+ <Interactive.Span>part</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/Circle.tsx b/packages/example/src/RoughNotation/Circle.tsxnew file mode 100644index 0000000000..96f09f6423--- /dev/null+++ b/packages/example/src/RoughNotation/Circle.tsx@@ -0,0 +1,52 @@+import {Circle} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationCircle: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>How much </Interactive.Span>+ <Circle+ name="Circle annotation"+ progress={interpolate(frame, [0, 43], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [Easing.bezier(0.42, 0, 0.58, 1)],+ })}+ roughness={1.8}+ strokeWidth={12}+ color={'rgba(37, 99, 235, 0.57)'}+ padding={{+ left: 10,+ right: 10,+ top: 10,+ bottom: 10,+ }}+ box={'inside'}+ >+ circular+ </Circle>{' '}+ <Interactive.Span>financing is in AI?</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/CrossedOff.tsx b/packages/example/src/RoughNotation/CrossedOff.tsxnew file mode 100644index 0000000000..9c8199d0da--- /dev/null+++ b/packages/example/src/RoughNotation/CrossedOff.tsx@@ -0,0 +1,44 @@+import {CrossedOff} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationCrossedOff: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Please </Interactive.Span>+ <CrossedOff+ name="Crossed off annotation"+ progress={interpolate(frame, [18, 39], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#eb2525'}+ strokeWidth={6}+ iterations={10}+ roughness={2}+ >+ remove+ </CrossedOff>{' '}+ <Interactive.Span>this</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/Highlight.tsx b/packages/example/src/RoughNotation/Highlight.tsxnew file mode 100644index 0000000000..ff4318925f--- /dev/null+++ b/packages/example/src/RoughNotation/Highlight.tsx@@ -0,0 +1,59 @@+import {Highlight} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Easing,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationHighlight: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>A truly </Interactive.Span>+ <Highlight+ name="Highlight annotation"+ progress={interpolate(frame, [0, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: [+ Easing.spring({+ damping: 200,+ mass: 1,+ stiffness: 100,+ allowTail: true,+ durationRestThreshold: 0.02,+ overshootClamping: false,+ }),+ ],+ })}+ color={'rgba(255, 236, 79, 0.62)'}+ maxRandomnessOffset={10}+ roughness={2.3}+ padding={{+ left: 20,+ right: 20,+ }}+ bowing={0}+ >+ remarkable+ </Highlight>{' '}+ <Interactive.Span>end to the World cup</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/StrikeThrough.tsx b/packages/example/src/RoughNotation/StrikeThrough.tsxnew file mode 100644index 0000000000..9ffd2a2252--- /dev/null+++ b/packages/example/src/RoughNotation/StrikeThrough.tsx@@ -0,0 +1,42 @@+import {StrikeThrough} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationStrikeThrough: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>The </Interactive.Span>+ <StrikeThrough+ name="Strike-through annotation"+ progress={interpolate(frame, [10, 25], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'#f11515'}+ strokeWidth={14}+ >+ forbidden+ </StrikeThrough>{' '}+ <Interactive.Span>fruit</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/Underline.tsx b/packages/example/src/RoughNotation/Underline.tsxnew file mode 100644index 0000000000..0eced4137b--- /dev/null+++ b/packages/example/src/RoughNotation/Underline.tsx@@ -0,0 +1,43 @@+import {Underline} from '@remotion/rough-notation';+import React from 'react';+import {+ AbsoluteFill,+ Interactive,+ interpolate,+ useCurrentFrame,+} from 'remotion';+import {containerStyle, fontFamily} from './shared';++export const RoughNotationUnderline: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <AbsoluteFill style={containerStyle}>+ <Interactive.Div+ style={{+ fontSize: 80,+ fontWeight: 700,+ lineHeight: 1.1,+ color: '#171717',+ fontFamily,+ width: 800,+ }}+ >+ <Interactive.Span>Underline </Interactive.Span>+ <Underline+ name="Underline annotation"+ progress={interpolate(frame, [14, 35], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ color={'rgba(53, 95, 143, 0.71)'}+ strokeWidth={10}+ iterations={3}+ >+ this+ </Underline>{' '}+ <Interactive.Span>phrase</Interactive.Span>+ </Interactive.Div>+ </AbsoluteFill>+ );+};diff --git a/packages/example/src/RoughNotation/index.ts b/packages/example/src/RoughNotation/index.tsnew file mode 100644index 0000000000..256f49c1c2--- /dev/null+++ b/packages/example/src/RoughNotation/index.ts@@ -0,0 +1,7 @@+export {RoughNotationBracket} from './Bracket';+export {RoughNotationBox} from './Box';+export {RoughNotationCircle} from './Circle';+export {RoughNotationCrossedOff} from './CrossedOff';+export {RoughNotationHighlight} from './Highlight';+export {RoughNotationStrikeThrough} from './StrikeThrough';+export {RoughNotationUnderline} from './Underline';diff --git a/packages/example/src/RoughNotation/paper-texture.element.tsx b/packages/example/src/RoughNotation/paper-texture.element.tsxnew file mode 100644index 0000000000..473617352c--- /dev/null+++ b/packages/example/src/RoughNotation/paper-texture.element.tsx@@ -0,0 +1,26 @@+import {paper} from '@remotion/effects/paper';+import React from 'react';+import {interpolate, Solid, useCurrentFrame} from 'remotion';++export const PaperTexture: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <Solid+ color="white"+ width={1920}+ height={1080}+ effects={[+ paper({+ colorFront: 'white',+ colorBack: 'white',+ seed: interpolate(frame, [0, 120], [0, 1000], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ posterize: 30,+ }),+ }),+ ]}+ />+ );+};diff --git a/packages/example/src/RoughNotation/shared.ts b/packages/example/src/RoughNotation/shared.tsnew file mode 100644index 0000000000..fe43ea5ff8--- /dev/null+++ b/packages/example/src/RoughNotation/shared.ts@@ -0,0 +1,12 @@+import {loadFont} from '@remotion/google-fonts/CormorantGaramond';+import React from 'react';++export const {fontFamily} = loadFont('normal', {+ weights: ['700'],+ subsets: ['latin'],+});++export const containerStyle: React.CSSProperties = {+ justifyContent: 'center',+ alignItems: 'center',+};diff --git a/packages/example/tsconfig.json b/packages/example/tsconfig.jsonindex 4324e1d89a..7a6eebe69f 100644--- a/packages/example/tsconfig.json+++ b/packages/example/tsconfig.json@@ -47,6 +47,7 @@{"path": "../sfx"},{"path": "../layout-utils"},{"path": "../media"},- {"path": "../rounded-text-box"}+ {"path": "../rounded-text-box"},+ {"path": "../rough-notation"}]}diff --git a/packages/rough-notation/.npmignore b/packages/rough-notation/.npmignorenew file mode 100644index 0000000000..eb76a5ae81--- /dev/null+++ b/packages/rough-notation/.npmignore@@ -0,0 +1,10 @@+dist/test/**+src+eslint.config.mjs+tsconfig.tsbuildinfo+*.tgz+.turbo+tsconfig.json+.prettierrc.js+bundle.ts+dist/cjs/testdiff --git a/packages/rough-notation/README.md b/packages/rough-notation/README.mdnew file mode 100644index 0000000000..9deae70cad--- /dev/null+++ b/packages/rough-notation/README.md@@ -0,0 +1,39 @@+# @remotion/rough-notation++Rough annotation primitives for Remotion++[](https://npmcharts.com/compare/@remotion/rough-notation?minimal=true)++## Installation++```bash+npm install @remotion/rough-notation --save-exact+```++When installing a Remotion package, make sure to align the version of all `remotion` and `@remotion/*` packages to the same version.+Remove the `^` character from the version number to use the exact version.++## Usage++Choose the component that matches the annotation you want to draw:++```tsx+import {Circle, Highlight} from '@remotion/rough-notation';++export const MyComp = () => {+ return (+ <div>+ <Highlight progress={1} color="yellow">+ Highlighted text+ </Highlight>+ <Circle progress={1} color="blue">+ Circled text+ </Circle>+ </div>+ );+};+```++The package exports `Highlight`, `Underline`, `StrikeThrough`, `CrossedOff`, `Box`, `Bracket`, and `Circle`.++See the [documentation](https://www.remotion.dev/docs/rough-notation) for more information.diff --git a/packages/rough-notation/bundle.ts b/packages/rough-notation/bundle.tsnew file mode 100644index 0000000000..846bbbc8a0--- /dev/null+++ b/packages/rough-notation/bundle.ts@@ -0,0 +1,34 @@+import {build} from 'bun';+import path from 'path';++if (process.env.NODE_ENV !== 'production') {+ throw new Error('This script must be run using NODE_ENV=production');+}++console.time('Generated.');+const output = await build({+ entrypoints: ['src/index.ts'],+ naming: '[name].mjs',+ external: [+ 'remotion',+ 'remotion/no-react',+ 'react',+ 'react/jsx-runtime',+ 'react/jsx-dev-runtime',+ 'react-dom',+ ],+});++if (!output.success) {+ console.log(output.logs.join('\n'));+ process.exit(1);+}++for (const file of output.outputs) {+ const str = await file.text();+ const out = path.join('dist', 'esm', file.path);++ await Bun.write(out, str);+}++console.timeEnd('Generated.');diff --git a/packages/rough-notation/eslint.config.mjs b/packages/rough-notation/eslint.config.mjsnew file mode 100644index 0000000000..ab29acaba0--- /dev/null+++ b/packages/rough-notation/eslint.config.mjs@@ -0,0 +1,7 @@+import {remotionFlatConfig} from '@remotion/eslint-config-internal';++const config = remotionFlatConfig({react: true});++export default {+ ...config,+};diff --git a/packages/rough-notation/package.json b/packages/rough-notation/package.jsonnew file mode 100644index 0000000000..41e297add1--- /dev/null+++ b/packages/rough-notation/package.json@@ -0,0 +1,61 @@+{+ "name": "@remotion/rough-notation",+ "version": "4.0.489",+ "description": "Rough annotation primitives for Remotion",+ "main": "dist/index.js",+ "types": "dist/index.d.ts",+ "module": "dist/esm/index.mjs",+ "repository": {+ "url": "https://github.com/remotion-dev/remotion/tree/main/packages/rough-notation"+ },+ "type": "module",+ "scripts": {+ "test": "bun test src/test",+ "formatting": "oxfmt src --check",+ "format": "oxfmt src",+ "lint": "eslint src",+ "watch": "tsgo -w",+ "make": "tsgo && bun --env-file=../.env.bundle bundle.ts"+ },+ "author": "Jonny Burger <[email protected]>",+ "contributors": [+ "Mohit Yadav <[email protected]>"+ ],+ "license": "MIT",+ "bugs": {+ "url": "https://github.com/remotion-dev/remotion/issues"+ },+ "dependencies": {+ "@remotion/paths": "workspace:*",+ "remotion": "workspace:*",+ "roughjs": "4.6.6"+ },+ "peerDependencies": {+ "react": ">=16.8.0",+ "react-dom": ">=16.8.0"+ },+ "exports": {+ ".": {+ "types": "./dist/index.d.ts",+ "module": "./dist/esm/index.mjs",+ "import": "./dist/esm/index.mjs"+ },+ "./package.json": "./package.json"+ },+ "devDependencies": {+ "react": "catalog:",+ "react-dom": "catalog:",+ "@remotion/eslint-config-internal": "workspace:*",+ "eslint": "catalog:",+ "@typescript/native-preview": "catalog:"+ },+ "keywords": [+ "remotion",+ "rough-notation",+ "annotations"+ ],+ "publishConfig": {+ "access": "public"+ },+ "homepage": "https://www.remotion.dev/docs/rough-notation"+}diff --git a/packages/rough-notation/src/Annotation.tsx b/packages/rough-notation/src/Annotation.tsxnew file mode 100644index 0000000000..eb1e726c9f--- /dev/null+++ b/packages/rough-notation/src/Annotation.tsx@@ -0,0 +1,498 @@+import React, {useMemo} from 'react';+import {+ Internals,+ Interactive,+ Sequence,+ type InteractiveBaseProps,+ type InteractivitySchema,+ type SequenceControls,+} from 'remotion';+import {createAnnotation} from './create-annotation';+import type {+ AnnotationConfig,+ Box as BoxMode,+ BoxConfig,+ BracketAnnotationConfig,+ CircleConfig,+ CrossedOffConfig,+ CurveAnnotationOptions,+ HighlightConfig,+ Padding,+ SharedRoughAnnotationOptions,+ StrikeThroughConfig,+ UnderlineConfig,+} from './types';++type SharedAnnotationComponentProps = Readonly<+ {+ readonly children: React.ReactNode;+ readonly progress: number;+ readonly seed?: number;+ readonly disabled?: boolean;+ readonly style?: React.CSSProperties;+ } & SharedRoughAnnotationOptions+>;++type AnnotationInteractiveProps<Config> = SharedAnnotationComponentProps &+ Readonly<Config> &+ InteractiveBaseProps;++export type HighlightProps = AnnotationInteractiveProps<HighlightConfig>;+export type UnderlineProps = AnnotationInteractiveProps<UnderlineConfig>;+export type StrikeThroughProps =+ AnnotationInteractiveProps<StrikeThroughConfig>;+export type CrossedOffProps = AnnotationInteractiveProps<CrossedOffConfig>;+export type BoxProps = AnnotationInteractiveProps<BoxConfig>;+export type BracketProps = AnnotationInteractiveProps<BracketAnnotationConfig>;+export type CircleProps = AnnotationInteractiveProps<+ CircleConfig & CurveAnnotationOptions+>;++type InternalAnnotationProps = SharedAnnotationComponentProps &+ InteractiveBaseProps & {+ readonly color?: string;+ readonly strokeWidth?: number;+ readonly padding?: Partial<Padding>;+ readonly iterations?: number;+ readonly rtl?: boolean;+ readonly box?: BoxMode;+ readonly bracketLeft?: boolean;+ readonly bracketRight?: boolean;+ readonly bracketTop?: boolean;+ readonly bracketBottom?: boolean;+ } & CurveAnnotationOptions;++const colorSchema = {+ color: {+ type: 'color',+ default: 'currentColor',+ description: 'Color',+ },+} as const satisfies InteractivitySchema;++const strokeWidthSchema = (defaultValue: number): InteractivitySchema => ({+ strokeWidth: {+ type: 'number',+ min: 0,+ step: 1,+ default: defaultValue,+ description: 'Stroke Width',+ hiddenFromList: false,+ },+});++const iterationsSchema = (defaultValue: number): InteractivitySchema => ({+ iterations: {+ type: 'number',+ min: 1,+ step: 1,+ default: defaultValue,+ description: 'Iterations',+ hiddenFromList: false,+ },+});++const rtlSchema = {+ rtl: {+ type: 'boolean',+ default: false,+ description: 'Right-to-left',+ },+} as const satisfies InteractivitySchema;++const roughJsControlsSchema = (+ defaultRoughness: number,+): InteractivitySchema => ({+ roughness: {+ type: 'number',+ min: 0,+ step: 0.1,+ default: defaultRoughness,+ description: 'Roughness',+ hiddenFromList: false,+ },+ maxRandomnessOffset: {+ type: 'number',+ min: 0,+ step: 0.1,+ default: 5,+ description: 'Max Randomness Offset',+ hiddenFromList: false,+ },+ bowing: {+ type: 'number',+ min: 0,+ step: 0.1,+ default: 1,+ description: 'Bowing',+ hiddenFromList: false,+ },+ disableMultiStroke: {+ type: 'boolean',+ default: false,+ description: 'Disable Multi Stroke',+ },+ preserveVertices: {+ type: 'boolean',+ default: false,+ description: 'Preserve Vertices',+ },+});++const curveControlsSchema = {+ curveFitting: {+ type: 'number',+ min: 0,+ step: 0.01,+ default: 0.95,+ description: 'Curve Fitting',+ hiddenFromList: false,+ },+ curveTightness: {+ type: 'number',+ step: 0.1,+ default: 0,+ description: 'Curve Tightness',+ hiddenFromList: false,+ },+ curveStepCount: {+ type: 'number',+ min: 1,+ step: 1,+ default: 9,+ description: 'Curve Step Count',+ hiddenFromList: false,+ },+} as const satisfies InteractivitySchema;++const paddingSchema = {+ 'padding.left': {+ type: 'number',+ step: 1,+ default: 0,+ description: 'Left Padding',+ hiddenFromList: false,+ },+ 'padding.right': {+ type: 'number',+ step: 1,+ default: 0,+ description: 'Right Padding',+ hiddenFromList: false,+ },+ 'padding.top': {+ type: 'number',+ step: 1,+ default: 0,+ description: 'Top Padding',+ hiddenFromList: false,+ },+ 'padding.bottom': {+ type: 'number',+ step: 1,+ default: 0,+ description: 'Bottom Padding',+ hiddenFromList: false,+ },+} as const satisfies InteractivitySchema;++const underlinePaddingSchema = {+ 'padding.top': paddingSchema['padding.top'],+} as const satisfies InteractivitySchema;++const textContentSchema = {+ children: {+ type: 'text-content',+ default: '',+ description: 'Text',+ keyframable: false,+ },+} as const satisfies InteractivitySchema;++const sharedSchema = (defaultRoughness: number): InteractivitySchema => ({+ ...Interactive.baseSchema,+ progress: {+ type: 'number',+ min: 0,+ max: 1,+ step: 0.01,+ default: 1,+ description: 'Progress',+ hiddenFromList: false,+ },+ disabled: {+ type: 'boolean',+ default: false,+ description: 'Disabled',+ },+ seed: {+ type: 'number',+ step: 1,+ default: 1,+ description: 'Seed',+ hiddenFromList: false,+ },+ ...roughJsControlsSchema(defaultRoughness),+ ...colorSchema,+ ...Interactive.textSchema,+ ...textContentSchema,+});++export const highlightSchema: InteractivitySchema = {+ ...sharedSchema(3),+ ...iterationsSchema(2),+ ...rtlSchema,+ ...paddingSchema,+};++export const underlineSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(20),+ ...iterationsSchema(2),+ ...rtlSchema,+ ...underlinePaddingSchema,+};++export const strikeThroughSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(20),+ ...iterationsSchema(1),+ ...rtlSchema,+};++export const crossedOffSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(20),+ ...iterationsSchema(1),+ ...rtlSchema,+};++export const boxSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(7),+ ...iterationsSchema(2),+ ...paddingSchema,+};++export const bracketSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(20),+ ...paddingSchema,+ bracketLeft: {+ type: 'boolean',+ default: false,+ description: 'Left Bracket',+ },+ bracketRight: {+ type: 'boolean',+ default: true,+ description: 'Right Bracket',+ },+ bracketTop: {+ type: 'boolean',+ default: false,+ description: 'Top Bracket',+ },+ bracketBottom: {+ type: 'boolean',+ default: false,+ description: 'Bottom Bracket',+ },+};++export const circleSchema: InteractivitySchema = {+ ...sharedSchema(1.5),+ ...strokeWidthSchema(20),+ ...iterationsSchema(2),+ ...paddingSchema,+ ...curveControlsSchema,+ box: {+ type: 'enum',+ default: 'around',+ description: 'Box',+ keyframable: false,+ variants: {+ inside: {},+ around: {},+ },+ },+};++const annotationSchemas = [+ highlightSchema,+ underlineSchema,+ strikeThroughSchema,+ crossedOffSchema,+ boxSchema,+ bracketSchema,+ circleSchema,+];++export {annotationSchemas};++type AnnotationStyle = Exclude<AnnotationConfig['type'], 'none'>;+type Layer = 'behind' | 'on-top';++const makeAnnotationComponent = ({+ type,+ componentName,+ documentationSlug,+ layer,+ schema,+}: {+ readonly type: AnnotationStyle;+ readonly componentName: string;+ readonly documentationSlug: string;+ readonly layer: Layer;+ readonly schema: InteractivitySchema;+}): React.FC<InternalAnnotationProps> => {+ const AnnotationInner: React.FC<+ InternalAnnotationProps & {+ readonly controls: SequenceControls | undefined;+ readonly stack?: string;+ }+ > = ({+ children,+ durationInFrames,+ from,+ trimBefore,+ freeze,+ hidden,+ name,+ showInTimeline,+ controls,+ stack,+ style,+ progress,+ seed,+ disabled,+ roughness,+ maxRandomnessOffset,+ bowing,+ curveFitting,+ curveTightness,+ curveStepCount,+ disableMultiStroke,+ preserveVertices,+ ...configProps+ }) => {+ const annotation = useMemo(() => {+ return createAnnotation();+ }, []);+ const outlineRef = React.useRef<HTMLSpanElement | null>(null);+ const config = (+ disabled ? {type: 'none'} : {...configProps, type}+ ) as AnnotationConfig;+ const annotationElement = (+ <annotation.Annotation+ {...config}+ progress={progress}+ seed={seed}+ roughness={roughness}+ maxRandomnessOffset={maxRandomnessOffset}+ bowing={bowing}+ curveFitting={curveFitting}+ curveTightness={curveTightness}+ curveStepCount={curveStepCount}+ disableMultiStroke={disableMultiStroke}+ preserveVertices={preserveVertices}+ />+ );++ return (+ <Sequence+ layout="none"+ from={from ?? 0}+ trimBefore={trimBefore}+ durationInFrames={durationInFrames ?? Infinity}+ freeze={freeze}+ hidden={hidden}+ name={name ?? `<${componentName}>`}+ showInTimeline={showInTimeline ?? true}+ controls={controls}+ _remotionInternalStack={stack}+ _remotionInternalDocumentationLink={`https://www.remotion.dev/docs/rough-notation/${documentationSlug}`}+ outlineRef={outlineRef}+ >+ <span ref={outlineRef} style={{display: 'inline-block'}}>+ <annotation.Container>+ {layer === 'behind' ? annotationElement : null}+ <annotation.Tracker style={style}>{children}</annotation.Tracker>+ {layer === 'on-top' ? annotationElement : null}+ </annotation.Container>+ </span>+ </Sequence>+ );+ };++ const Component = Interactive.withSchema({+ Component: AnnotationInner,+ componentName: `<${componentName}>`,+ componentIdentity: Interactive._internalMakeRemotionComponentIdentity({+ packageName: '@remotion/rough-notation',+ componentName,+ }),+ schema,+ supportsEffects: false,+ }) as React.FC<InternalAnnotationProps>;++ Component.displayName = componentName;+ Internals.addSequenceStackTraces(Component);+ return Component;+};++export const Highlight = makeAnnotationComponent({+ type: 'highlight',+ componentName: 'Highlight',+ documentationSlug: 'highlight',+ layer: 'behind',+ schema: highlightSchema,+}) as React.FC<HighlightProps>;++export const Underline = makeAnnotationComponent({+ type: 'underline',+ componentName: 'Underline',+ documentationSlug: 'underline',+ layer: 'on-top',+ schema: underlineSchema,+}) as React.FC<UnderlineProps>;++export const StrikeThrough = makeAnnotationComponent({+ type: 'strike-through',+ componentName: 'StrikeThrough',+ documentationSlug: 'strike-through',+ layer: 'on-top',+ schema: strikeThroughSchema,+}) as React.FC<StrikeThroughProps>;++export const CrossedOff = makeAnnotationComponent({+ type: 'crossed-off',+ componentName: 'CrossedOff',+ documentationSlug: 'crossed-off',+ layer: 'on-top',+ schema: crossedOffSchema,+}) as React.FC<CrossedOffProps>;++export const Box = makeAnnotationComponent({+ type: 'box',+ componentName: 'Box',+ documentationSlug: 'box',+ layer: 'on-top',+ schema: boxSchema,+}) as React.FC<BoxProps>;++export const Bracket = makeAnnotationComponent({+ type: 'bracket',+ componentName: 'Bracket',+ documentationSlug: 'bracket',+ layer: 'on-top',+ schema: bracketSchema,+}) as React.FC<BracketProps>;++export const Circle = makeAnnotationComponent({+ type: 'circle',+ componentName: 'Circle',+ documentationSlug: 'circle',+ layer: 'on-top',+ schema: circleSchema,+}) as React.FC<CircleProps>;diff --git a/packages/rough-notation/src/create-annotation.tsx b/packages/rough-notation/src/create-annotation.tsxnew file mode 100644index 0000000000..29a1a52cbd--- /dev/null+++ b/packages/rough-notation/src/create-annotation.tsx@@ -0,0 +1,173 @@+import React, {+ createContext,+ createRef,+ useEffect,+ useMemo,+ useState,+} from 'react';+import {continueRender, delayRender} from 'remotion';+import {useElementSize} from './element-size';+import {render} from './rough';+import {+ resolveAnnotationConfig,+ resolveRoughOptions,+ type AnnotationConfig,+ type RoughAnnotationOptions,+} from './types';++const AnnotationContext = createContext<{+ readonly svgChildren: React.ReactElement[];+ readonly setSvgChildren: React.Dispatch<+ React.SetStateAction<React.ReactElement[]>+ >;+}>({+ setSvgChildren: () => undefined,+ svgChildren: [],+});++const MEASURER_SIZE = 100;++const measurerSize: React.CSSProperties = {+ height: MEASURER_SIZE,+ width: MEASURER_SIZE,+ position: 'fixed',+ opacity: 0,+ top: -10000,+};++type ChildrenProps = {+ readonly children: React.ReactNode;+};++type TrackerProps = ChildrenProps & {+ readonly style?: React.CSSProperties;+};++type AnnotationProps = Readonly<+ AnnotationConfig & {+ seed?: number;+ progress: number;+ } & RoughAnnotationOptions+>;++export const createAnnotation = () => {+ const ref = createRef<HTMLSpanElement>();+ const svgRef = createRef<SVGSVGElement>();+ const measurer = createRef<HTMLDivElement>();++ const Container: React.FC<ChildrenProps> = (props) => {+ const [svgChildren, setSvgChildren] = useState<React.ReactElement[]>([]);++ const value = useMemo(() => {+ return {setSvgChildren, svgChildren};+ }, [svgChildren]);++ return (+ <AnnotationContext.Provider value={value}>+ {props.children}+ <div ref={measurer} style={measurerSize} />+ </AnnotationContext.Provider>+ );+ };++ const Tracker: React.FC<TrackerProps> = ({children, style}) => {+ return (+ <span+ ref={ref}+ style={{+ ...style,+ display: 'inline-block',+ position: 'relative',+ whiteSpace: 'pre',+ }}+ >+ {children}+ </span>+ );+ };++ const Annotation: React.FC<AnnotationProps> = ({+ roughness,+ maxRandomnessOffset,+ bowing,+ curveFitting,+ curveTightness,+ curveStepCount,+ disableMultiStroke,+ preserveVertices,+ seed,+ progress,+ ...config+ }) => {+ const parsed = useMemo(() => {+ return resolveAnnotationConfig(config);+ }, [config]);+ const roughJsOptions = useMemo(() => {+ return resolveRoughOptions({+ roughness,+ maxRandomnessOffset,+ bowing,+ curveFitting,+ curveTightness,+ curveStepCount,+ disableMultiStroke,+ preserveVertices,+ });+ }, [+ bowing,+ curveFitting,+ curveStepCount,+ curveTightness,+ disableMultiStroke,+ maxRandomnessOffset,+ preserveVertices,+ roughness,+ ]);++ const [initial] = useState(() => delayRender());+ const size = useElementSize(ref);++ useEffect(() => {+ if (size === null) {+ return;+ }++ continueRender(initial);+ }, [initial, size]);++ const scale = measurer.current+ ? measurer.current.getBoundingClientRect().width / MEASURER_SIZE+ : null;++ const svgChildren =+ ref.current && scale+ ? render({+ config: parsed,+ svg: svgRef.current as SVGSVGElement,+ element: ref.current,+ seed: seed ?? 1,+ scale,+ progress,+ options: roughJsOptions,+ })+ : [];++ return (+ <svg+ ref={svgRef}+ style={{+ position: 'absolute',+ top: 0,+ left: 0,+ overflow: 'visible',+ width: 100,+ height: 100,+ }}+ >+ {svgChildren}+ </svg>+ );+ };++ return {Container, Tracker, Annotation};+};diff --git a/packages/rough-notation/src/element-size.ts b/packages/rough-notation/src/element-size.tsnew file mode 100644index 0000000000..9e6fc61395--- /dev/null+++ b/packages/rough-notation/src/element-size.ts@@ -0,0 +1,113 @@+import {useCallback, useEffect, useMemo, useState} from 'react';++export type Size = {+ readonly width: number;+ readonly height: number;+ readonly left: number;+ readonly top: number;+ readonly refresh: () => void;+};++export const useElementSize = (+ ref: React.RefObject<HTMLElement | null>,+): Size | null => {+ const [size, setSize] = useState<Omit<Size, 'refresh'> | null>(() => {+ if (!ref.current) {+ return null;+ }++ const rect = ref.current.getClientRects();+ if (!rect[0]) {+ return null;+ }++ return {+ width: rect[0].width,+ height: rect[0].height,+ left: rect[0].x,+ top: rect[0].y,+ };+ });++ const observer = useMemo(() => {+ if (typeof ResizeObserver === 'undefined') {+ return null;+ }++ return new ResizeObserver((entries) => {+ const {target} = entries[0];+ const newSize = target.getClientRects();++ if (!newSize?.[0]) {+ setSize(null);+ return;+ }++ const {width, height} = newSize[0];++ setSize({+ width,+ height,+ left: newSize[0].x,+ top: newSize[0].y,+ });+ });+ }, []);++ const updateSize = useCallback(() => {+ if (!ref.current) {+ return;+ }++ const rect = ref.current.getClientRects();+ if (!rect[0]) {+ setSize(null);+ return;+ }++ setSize((prevState) => {+ const isSame =+ prevState &&+ prevState.width === rect[0].width &&+ prevState.height === rect[0].height &&+ prevState.left === rect[0].x &&+ prevState.top === rect[0].y;++ if (isSame) {+ return prevState;+ }++ return {+ width: rect[0].width,+ height: rect[0].height,+ left: rect[0].x,+ top: rect[0].y,+ };+ });+ }, [ref]);++ useEffect(() => {+ if (!observer) {+ return;+ }++ const {current} = ref;+ if (current) {+ observer.observe(current);+ }++ return (): void => {+ if (current) {+ observer.unobserve(current);+ }+ };+ }, [observer, ref, updateSize]);++ return useMemo(() => {+ if (!size) {+ return null;+ }++ return {...size, refresh: updateSize};+ }, [size, updateSize]);+};diff --git a/packages/rough-notation/src/index.ts b/packages/rough-notation/src/index.tsnew file mode 100644index 0000000000..e565afea66--- /dev/null+++ b/packages/rough-notation/src/index.ts@@ -0,0 +1,19 @@+export {+ Box,+ Bracket,+ Circle,+ CrossedOff,+ Highlight,+ StrikeThrough,+ Underline,+} from './Annotation';+export type {+ BoxProps,+ BracketProps,+ CircleProps,+ CrossedOffProps,+ HighlightProps,+ StrikeThroughProps,+ UnderlineProps,+} from './Annotation';+export type {Padding} from './types';diff --git a/packages/rough-notation/src/render-annotation.tsx b/packages/rough-notation/src/render-annotation.tsxnew file mode 100644index 0000000000..1af71de26f--- /dev/null+++ b/packages/rough-notation/src/render-annotation.tsx@@ -0,0 +1,361 @@+import {evolvePath} from '@remotion/paths';+import type {OpSet, ResolvedOptions} from 'roughjs/bin/core';+import type {Point} from 'roughjs/bin/geometry';+import {ellipse, line, linearPath, rectangle} from 'roughjs/bin/renderer.js';+import type {+ Rect,+ ResolvedAnnotationConfig,+ RoughAnnotationOptions,+} from './types';++const opsToPath = (opList: OpSet[]): string[] => {+ const paths: string[] = [];+ for (const drawing of opList) {+ let path = '';+ for (const item of drawing.ops) {+ const {data} = item;+ if (item.op === 'move') {+ if (path.trim()) {+ paths.push(path.trim());+ }++ path = `M${data[0]} ${data[1]} `;+ } else if (item.op === 'bcurveTo') {+ path += `C${data[0]} ${data[1]}, ${data[2]} ${data[3]}, ${data[4]} ${data[5]} `;+ } else if (item.op === 'lineTo') {+ path += `L${data[0]} ${data[1]} `;+ }+ }++ if (path.trim()) {+ paths.push(path.trim());+ }+ }++ return paths;+};++export const addKeysToPaths = (+ paths: string[],+): {readonly d: string; readonly key: string}[] => {+ const occurrences = new Map<string, number>();++ return paths.map((d) => {+ const occurrence = occurrences.get(d) ?? 0;+ occurrences.set(d, occurrence + 1);++ return {d, key: `${d}-${occurrence}`};+ });+};++type RoughOptionsType = 'highlight' | 'single' | 'double';++const getOptions = (+ type: RoughOptionsType,+ seed: number,+ overrides: RoughAnnotationOptions,+): ResolvedOptions => {+ return {+ maxRandomnessOffset: 5,+ roughness: type === 'highlight' ? 3 : 1.5,+ bowing: 1,+ stroke: '#000',+ strokeWidth: 1.5,+ curveTightness: 0,+ curveFitting: 0.95,+ curveStepCount: 9,+ fillStyle: 'hachure',+ fillWeight: -1,+ hachureAngle: -41,+ hachureGap: -1,+ dashOffset: -1,+ dashGap: -1,+ zigzagOffset: -1,+ disableMultiStroke: type !== 'double',+ disableMultiStrokeFill: false,+ fillShapeRoughnessGain: 1.5,+ preserveVertices: false,+ ...overrides,+ seed,+ };+};++const getCircleItems = (rect: Rect, config: ResolvedAnnotationConfig) => {+ if (config.type !== 'circle') {+ throw new Error('Not a circle');+ }++ if (config.box === 'inside') {+ const paddedWidth = rect.w + (config.padding.left + config.padding.right);+ const paddedHeight = rect.h + (config.padding.top + config.padding.bottom);+ const x = rect.x - config.padding.left + paddedWidth / 2;+ const y = rect.y - config.padding.top + paddedHeight / 2;+ return {width: paddedWidth, height: paddedHeight, x, y};+ }++ const cx =+ rect.x + rect.w / 2 - config.padding.left / 2 + config.padding.right / 2;+ const cy =+ rect.y + rect.h / 2 - config.padding.top / 2 + config.padding.bottom / 2;++ const width = rect.w + config.padding.left + config.padding.right;+ const height = rect.h + config.padding.top + config.padding.bottom;++ return {+ width: (width / Math.sqrt(2)) * 2,+ height: (height / Math.sqrt(2)) * 2,+ x: cx,+ y: cy,+ };+};++export function getInstructions({+ rect,+ config,+ seed,+ options,+}: {+ readonly rect: Rect;+ readonly config: ResolvedAnnotationConfig;+ readonly seed: number;+ readonly options: RoughAnnotationOptions;+}): {opList: OpSet[]; strokeWidth: number} {+ if (config.type === 'none') {+ return {opList: [], strokeWidth: 0};+ }++ if (config.type === 'underline') {+ const o = getOptions('single', seed, options);+ const {iterations} = config;+ const rtl = config.rtl ? 1 : 0;+ const opList: OpSet[] = [];+ const y = rect.y + rect.h + config.padding.top;++ for (let i = rtl; i < iterations + rtl; i++) {+ if (i % 2) {+ opList.push(line(rect.x + rect.w, y, rect.x, y, o));+ } else {+ opList.push(line(rect.x, y, rect.x + rect.w, y, o));+ }+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'strike-through') {+ const o = getOptions('single', seed, options);+ const {iterations} = config;+ const rtl = config.rtl ? 1 : 0;+ const opList: OpSet[] = [];+ const y = rect.y + rect.h / 2;++ for (let i = rtl; i < iterations + rtl; i++) {+ if (i % 2) {+ opList.push(line(rect.x + rect.w, y, rect.x, y, o));+ } else {+ opList.push(line(rect.x, y, rect.x + rect.w, y, o));+ }+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'box') {+ const o = getOptions('single', seed, options);+ const {iterations} = config;+ const opList: OpSet[] = [];+ const x = rect.x - config.padding.left;+ const y = rect.y - config.padding.top;+ const width = rect.w + (config.padding.left + config.padding.right);+ const height = rect.h + (config.padding.top + config.padding.bottom);++ for (let i = 0; i < iterations; i++) {+ opList.push(rectangle(x, y, width, height, o));+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'bracket') {+ const o = getOptions('single', seed, options);+ const opList: OpSet[] = [];+ const lx = rect.x - config.padding.left;+ const rx = rect.x + rect.w + config.padding.right;+ const ty = rect.y - config.padding.top;+ const by = rect.y + rect.h + config.padding.bottom;+ const sides: {+ readonly enabled: boolean;+ readonly points: Point[];+ }[] = [+ {+ enabled: config.bracketBottom,+ points: [+ [lx, by],+ [rx, by],+ ],+ },+ {+ enabled: config.bracketTop,+ points: [+ [lx, ty],+ [rx, ty],+ ],+ },+ {+ enabled: config.bracketLeft,+ points: [+ [lx, ty],+ [lx, by],+ ],+ },+ {+ enabled: config.bracketRight,+ points: [+ [rx, ty],+ [rx, by],+ ],+ },+ ];++ for (const side of sides) {+ if (side.enabled) {+ opList.push(linearPath(side.points, false, o));+ }+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'crossed-off') {+ const o = getOptions('single', seed, options);+ const {iterations} = config;+ const rtl = config.rtl ? 1 : 0;+ const opList: OpSet[] = [];+ const {x} = rect;+ const {y} = rect;+ const x2 = x + rect.w;+ const y2 = y + rect.h;++ for (let i = rtl; i < iterations + rtl; i++) {+ if (i % 2) {+ opList.push(line(x2, y2, x, y, o));+ } else {+ opList.push(line(x, y, x2, y2, o));+ }+ }++ for (let i = rtl; i < iterations + rtl; i++) {+ if (i % 2) {+ opList.push(line(x, y2, x2, y, o));+ } else {+ opList.push(line(x2, y, x, y2, o));+ }+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'circle') {+ const {iterations} = config;+ const opList: OpSet[] = [];+ const {width, height, x, y} = getCircleItems(rect, config);++ for (let i = 0; i < iterations; i++) {+ const o = getOptions('single', seed + i, options);+ opList.push(ellipse(x, y, width, height, o));+ }++ return {opList, strokeWidth: config.strokeWidth};+ }++ if (config.type === 'highlight') {+ const {iterations} = config;+ const rtl = config.rtl ? 1 : 0;+ const opList: OpSet[] = [];+ const y =+ rect.y + rect.h / 2 + (config.padding.bottom - config.padding.top) / 2;++ for (let i = rtl; i < iterations + rtl; i++) {+ const o = getOptions('highlight', seed + i, options);+ if (i % 2) {+ opList.push(+ line(+ rect.x + rect.w + config.padding.right,+ y,+ rect.x - config.padding.left,+ y,+ o,+ ),+ );+ } else {+ opList.push(+ line(+ rect.x - config.padding.left,+ y,+ rect.x + rect.w + config.padding.right,+ y,+ o,+ ),+ );+ }+ }++ return {+ opList,+ strokeWidth: rect.h + config.padding.top + config.padding.bottom,+ };+ }++ throw new Error(`Unrecognized annotation type: ${config}`);+}++export const renderAnnotation = ({+ rect,+ config,+ seed,+ progress,+ options,+}: {+ readonly rect: Rect;+ readonly config: ResolvedAnnotationConfig;+ readonly seed: number;+ readonly progress: number;+ readonly options: RoughAnnotationOptions;+}) => {+ if (config.type === 'none') {+ return [];+ }++ const {opList, strokeWidth} = getInstructions({+ config,+ rect,+ seed,+ options,+ });++ const pathsWithKeys = addKeysToPaths(opsToPath(opList));++ return pathsWithKeys.map(({d, key}, i) => {+ const isLast = i === pathsWithKeys.length - 1;+ const progressForIteration = Math.max(+ 0,+ Math.min(isLast ? Infinity : 1, progress * pathsWithKeys.length - i),+ );+ const {strokeDasharray, strokeDashoffset} = evolvePath(+ progressForIteration,+ d,+ );++ return (+ <path+ key={key}+ d={d}+ fill="none"+ stroke={config.color}+ strokeWidth={strokeWidth}+ strokeDasharray={strokeDasharray}+ strokeDashoffset={strokeDashoffset}+ />+ );+ });+};diff --git a/packages/rough-notation/src/rough.ts b/packages/rough-notation/src/rough.tsnew file mode 100644index 0000000000..fc2de3a864--- /dev/null+++ b/packages/rough-notation/src/rough.ts@@ -0,0 +1,63 @@+import type React from 'react';+import {renderAnnotation} from './render-annotation';+import type {+ Rect,+ ResolvedAnnotationConfig,+ RoughAnnotationOptions,+} from './types';++const svgRect = ({+ svg,+ element,+ scale,+}: {+ readonly svg: SVGSVGElement;+ readonly element: HTMLElement;+ readonly scale: number;+}): Rect => {+ const rect1 = svg.getBoundingClientRect();+ const rect2 = element.getBoundingClientRect();+ const inverseScale = 1 / scale;++ return {+ x: (rect2.x - rect1.x) * inverseScale,+ y: (rect2.y - rect1.y) * inverseScale,+ w: rect2.width * inverseScale,+ h: rect2.height * inverseScale,+ };+};++export const render = ({+ svg,+ seed,+ element,+ config,+ scale,+ progress,+ options,+}: {+ readonly svg: SVGSVGElement;+ readonly seed: number;+ readonly element: HTMLElement;+ readonly config: ResolvedAnnotationConfig;+ readonly scale: number;+ readonly progress: number;+ readonly options: RoughAnnotationOptions;+}): React.ReactElement[] => {+ if (scale === 0) {+ return [];+ }++ const rect = svgRect({svg, element, scale});+ if (rect.w === 0 || rect.h === 0) {+ return [];+ }++ return renderAnnotation({+ config,+ seed,+ rect,+ progress,+ options,+ });+};diff --git a/packages/rough-notation/src/test/annotation-schema.test.ts b/packages/rough-notation/src/test/annotation-schema.test.tsnew file mode 100644index 0000000000..54e8259a0e--- /dev/null+++ b/packages/rough-notation/src/test/annotation-schema.test.ts@@ -0,0 +1,76 @@+import {expect, test} from 'bun:test';+import {Internals, type InteractivitySchema} from 'remotion';+import {+ annotationSchemas,+ boxSchema,+ bracketSchema,+ circleSchema,+ crossedOffSchema,+ highlightSchema,+ strikeThroughSchema,+ underlineSchema,+} from '../Annotation';++const keys = (schema: InteractivitySchema) => Object.keys(schema);++test('named annotation schemas do not expose a type selector', () => {+ for (const schema of annotationSchemas) {+ expect(keys(schema)).not.toContain('type');+ expect(keys(schema)).toContain('disabled');+ }+});++test('underline exposes only effective padding', () => {+ expect(keys(underlineSchema)).toContain('padding.top');+ expect(keys(underlineSchema)).not.toContain('padding.left');+ expect(keys(underlineSchema)).not.toContain('padding.right');+ expect(keys(underlineSchema)).not.toContain('padding.bottom');+});++test('padding is only exposed by annotations that use it', () => {+ for (const schema of [+ boxSchema,+ bracketSchema,+ circleSchema,+ highlightSchema,+ ]) {+ expect(keys(schema)).toContain('padding.left');+ expect(keys(schema)).toContain('padding.right');+ expect(keys(schema)).toContain('padding.top');+ expect(keys(schema)).toContain('padding.bottom');+ }++ for (const schema of [strikeThroughSchema, crossedOffSchema]) {+ expect(keys(schema)).not.toContain('padding.left');+ expect(keys(schema)).not.toContain('padding.top');+ }+});++test('component-specific controls are isolated to their schemas', () => {+ expect(keys(highlightSchema)).not.toContain('strokeWidth');+ expect(keys(circleSchema)).toContain('curveFitting');+ expect(keys(circleSchema)).toContain('curveTightness');+ expect(keys(circleSchema)).toContain('curveStepCount');+ expect(keys(bracketSchema)).not.toContain('curveFitting');+ expect(keys(bracketSchema)).toContain('bracketLeft');+ expect(keys(bracketSchema)).toContain('bracketRight');+ expect(keys(boxSchema)).not.toContain('bracketRight');+});++test('all named annotations expose text, font, and seed controls', () => {+ for (const schema of annotationSchemas) {+ expect(keys(schema)).toContain('children');+ expect(keys(schema)).toContain('style.fontFamily');+ expect(keys(schema)).toContain('style.fontSize');+ expect(keys(schema)).toContain('style.fontWeight');+ expect(keys(schema)).toContain('style.fontStyle');+ expect(keys(schema)).toContain('style.letterSpacing');+ expect(schema.seed).not.toHaveProperty('keyframable', false);+ }+});++test('all named annotation schemas can be flattened', () => {+ for (const schema of annotationSchemas) {+ expect(() => Internals.getFlatSchemaWithAllKeys(schema)).not.toThrow();+ }+});diff --git a/packages/rough-notation/src/test/render-annotation.test.tsx b/packages/rough-notation/src/test/render-annotation.test.tsxnew file mode 100644index 0000000000..a3f49b1623--- /dev/null+++ b/packages/rough-notation/src/test/render-annotation.test.tsx@@ -0,0 +1,193 @@+import {expect, test} from 'bun:test';+import type {ReactElement} from 'react';+import {+ addKeysToPaths,+ getInstructions,+ renderAnnotation,+} from '../render-annotation';+import type {RoughAnnotationOptions} from '../types';++test('type none renders no annotation paths', () => {+ const result = renderAnnotation({+ rect: {x: 0, y: 0, w: 100, h: 40},+ config: {type: 'none'},+ seed: 1,+ progress: 1,+ options: {},+ });++ expect(result).toEqual([]);+});++test('circle iterations use different seeds', () => {+ const result = renderAnnotation({+ rect: {x: 0, y: 0, w: 100, h: 40},+ config: {+ type: 'circle',+ color: 'red',+ strokeWidth: 10,+ padding: {left: 0, right: 0, top: 0, bottom: 0},+ iterations: 2,+ box: 'inside',+ },+ seed: 1,+ progress: 1,+ options: {},+ });++ const paths = result.map(+ (path) => (path as ReactElement<{d: string}>).props.d,+ );+ expect(paths).toHaveLength(2);+ expect(paths[0]).not.toBe(paths[1]);+});++test('circle iteration seeds cannot be overwritten by rough options', () => {+ const result = renderAnnotation({+ rect: {x: 0, y: 0, w: 100, h: 40},+ config: {+ type: 'circle',+ color: 'red',+ strokeWidth: 10,+ padding: {left: 0, right: 0, top: 0, bottom: 0},+ iterations: 2,+ box: 'inside',+ },+ seed: 1,+ progress: 1,+ options: {seed: 1} as RoughAnnotationOptions,+ });++ const paths = result.map(+ (path) => (path as ReactElement<{d: string}>).props.d,+ );+ expect(paths).toHaveLength(2);+ expect(paths[0]).not.toBe(paths[1]);+});++test('identical paths receive unique occurrence-aware keys', () => {+ expect(addKeysToPaths(['same', 'same', 'different', 'same'])).toEqual([+ {d: 'same', key: 'same-0'},+ {d: 'same', key: 'same-1'},+ {d: 'different', key: 'different-0'},+ {d: 'same', key: 'same-2'},+ ]);+});++test('bracket padding expands the full bracket bounds', () => {+ const result = getInstructions({+ rect: {x: 10, y: 20, w: 100, h: 40},+ config: {+ type: 'bracket',+ color: 'red',+ strokeWidth: 8,+ padding: {left: 5, right: 7, top: 11, bottom: 13},+ bracketLeft: true,+ bracketRight: true,+ bracketTop: true,+ bracketBottom: true,+ },+ seed: 1,+ options: {+ roughness: 0,+ maxRandomnessOffset: 0,+ preserveVertices: true,+ },+ });++ const coordinates = result.opList.flatMap((set) =>+ set.ops.flatMap((op) => op.data),+ );+ expect(Math.min(...coordinates)).toBe(5);+ expect(Math.max(...coordinates)).toBe(117);+ expect(coordinates).toContain(9);+ expect(coordinates).toContain(73);+});++test('bracket top padding expands left and right side height', () => {+ const result = getInstructions({+ rect: {x: 10, y: 20, w: 100, h: 40},+ config: {+ type: 'bracket',+ color: 'red',+ strokeWidth: 8,+ padding: {left: 5, right: 7, top: 11, bottom: 0},+ bracketLeft: true,+ bracketRight: true,+ bracketTop: false,+ bracketBottom: false,+ },+ seed: 1,+ options: {+ roughness: 0,+ maxRandomnessOffset: 0,+ preserveVertices: true,+ },+ });++ expect(result.opList).toHaveLength(2);++ const yCoordinates = result.opList.map((set) =>+ set.ops.flatMap((op) => op.data.filter((_, index) => index % 2 === 1)),+ );++ for (const yValues of yCoordinates) {+ expect(Math.min(...yValues)).toBe(9);+ expect(Math.max(...yValues)).toBe(60);+ }+});++test('curve controls affect circles but not brackets', () => {+ const rect = {x: 10, y: 20, w: 100, h: 40};+ const curveOptions = {+ curveFitting: 0.2,+ curveTightness: 1,+ curveStepCount: 3,+ };+ const bracketConfig = {+ type: 'bracket',+ color: 'red',+ strokeWidth: 8,+ padding: {left: 5, right: 7, top: 11, bottom: 13},+ bracketLeft: true,+ bracketRight: true,+ bracketTop: true,+ bracketBottom: true,+ } as const;+ const circleConfig = {+ type: 'circle',+ color: 'red',+ strokeWidth: 8,+ padding: {left: 5, right: 7, top: 11, bottom: 13},+ iterations: 1,+ box: 'inside',+ } as const;++ const bracketBase = getInstructions({+ rect,+ config: bracketConfig,+ seed: 1,+ options: {},+ }).opList;+ const bracketWithCurves = getInstructions({+ rect,+ config: bracketConfig,+ seed: 1,+ options: curveOptions,+ }).opList;+ const circleBase = getInstructions({+ rect,+ config: circleConfig,+ seed: 1,+ options: {},+ }).opList;+ const circleWithCurves = getInstructions({+ rect,+ config: circleConfig,+ seed: 1,+ options: curveOptions,+ }).opList;++ expect(bracketWithCurves).toEqual(bracketBase);+ expect(circleWithCurves).not.toEqual(circleBase);+});diff --git a/packages/rough-notation/src/test/types.test.ts b/packages/rough-notation/src/test/types.test.tsnew file mode 100644index 0000000000..d487c0960c--- /dev/null+++ b/packages/rough-notation/src/test/types.test.ts@@ -0,0 +1,54 @@+import {expect, test} from 'bun:test';+import {resolveAnnotationConfig} from '../types';++test('resolves defaults for annotation configs without zod', () => {+ expect(resolveAnnotationConfig({type: 'underline'})).toEqual({+ type: 'underline',+ color: 'currentColor',+ strokeWidth: 20,+ padding: {bottom: 0, left: 0, right: 0, top: 0},+ iterations: 2,+ rtl: false,+ });++ expect(resolveAnnotationConfig({type: 'bracket'})).toEqual({+ type: 'bracket',+ color: 'currentColor',+ strokeWidth: 20,+ padding: {bottom: 0, left: 0, right: 0, top: 0},+ bracketLeft: false,+ bracketRight: true,+ bracketTop: false,+ bracketBottom: false,+ });++ expect(resolveAnnotationConfig({type: 'circle'})).toEqual({+ type: 'circle',+ color: 'currentColor',+ strokeWidth: 20,+ padding: {bottom: 0, left: 0, right: 0, top: 0},+ iterations: 2,+ box: 'around',+ });+});++test('resolves partial padding for annotation configs', () => {+ expect(+ resolveAnnotationConfig({+ type: 'highlight',+ padding: {left: 10, right: 5},+ }),+ ).toEqual({+ type: 'highlight',+ color: 'currentColor',+ padding: {bottom: 0, left: 10, right: 5, top: 0},+ iterations: 2,+ rtl: false,+ });+});++test('validates annotation iterations at runtime', () => {+ expect(() =>+ resolveAnnotationConfig({type: 'highlight', iterations: 0}),+ ).toThrow(/iterations/);+});diff --git a/packages/rough-notation/src/types.ts b/packages/rough-notation/src/types.tsnew file mode 100644index 0000000000..30aecee854--- /dev/null+++ b/packages/rough-notation/src/types.ts@@ -0,0 +1,313 @@+export type Rect = {+ readonly x: number;+ readonly y: number;+ readonly w: number;+ readonly h: number;+};++export type Padding = {+ readonly left: number;+ readonly right: number;+ readonly top: number;+ readonly bottom: number;+};++export type Box = 'inside' | 'around';++export type RoughAnnotationOptions = {+ readonly roughness?: number;+ readonly maxRandomnessOffset?: number;+ readonly bowing?: number;+ readonly curveFitting?: number;+ readonly curveTightness?: number;+ readonly curveStepCount?: number;+ readonly disableMultiStroke?: boolean;+ readonly preserveVertices?: boolean;+};++export type SharedRoughAnnotationOptions = Omit<+ RoughAnnotationOptions,+ 'curveFitting' | 'curveTightness' | 'curveStepCount'+>;++export type CurveAnnotationOptions = Pick<+ RoughAnnotationOptions,+ 'curveFitting' | 'curveTightness' | 'curveStepCount'+>;++type ColorConfig = {+ readonly color?: string;+};++type StrokeConfig = ColorConfig & {+ readonly strokeWidth?: number;+};++type PaddingConfig = {+ readonly padding?: Partial<Padding>;+};++type UnderlinePaddingConfig = {+ readonly padding?: {+ readonly top?: number;+ };+};++type IterationConfig = {+ readonly iterations?: number;+};++type RtlConfig = {+ readonly rtl?: boolean;+};++type BracketConfig = {+ readonly bracketLeft?: boolean;+ readonly bracketRight?: boolean;+ readonly bracketTop?: boolean;+ readonly bracketBottom?: boolean;+};++export type UnderlineConfig = StrokeConfig &+ UnderlinePaddingConfig &+ IterationConfig &+ RtlConfig;++export type StrikeThroughConfig = StrokeConfig & IterationConfig & RtlConfig;++export type BoxConfig = StrokeConfig & PaddingConfig & IterationConfig;++export type BracketAnnotationConfig = BracketConfig &+ StrokeConfig &+ PaddingConfig;++export type CrossedOffConfig = StrokeConfig & IterationConfig & RtlConfig;++export type CircleConfig = StrokeConfig &+ PaddingConfig &+ IterationConfig & {+ readonly box?: Box;+ };++export type HighlightConfig = ColorConfig &+ PaddingConfig &+ IterationConfig &+ RtlConfig;++export type AnnotationConfig =+ | {+ readonly type: 'none';+ }+ | (UnderlineConfig & {+ readonly type: 'underline';+ })+ | (StrikeThroughConfig & {+ readonly type: 'strike-through';+ })+ | (BoxConfig & {+ readonly type: 'box';+ })+ | (BracketAnnotationConfig & {+ readonly type: 'bracket';+ })+ | (CrossedOffConfig & {+ readonly type: 'crossed-off';+ })+ | (CircleConfig & {+ readonly type: 'circle';+ })+ | (HighlightConfig & {+ readonly type: 'highlight';+ });++type ResolvedSharedConfig = {+ readonly color: string;+ readonly strokeWidth: number;+};++type ResolvedPaddingConfig = {+ readonly padding: Padding;+};++type ResolvedIterationConfig = {+ readonly iterations: number;+};++type ResolvedRtlConfig = {+ readonly rtl: boolean;+};++export type ResolvedAnnotationConfig =+ | {+ readonly type: 'none';+ }+ | ({+ readonly type: 'underline';+ } & ResolvedSharedConfig &+ ResolvedPaddingConfig &+ ResolvedIterationConfig &+ ResolvedRtlConfig)+ | ({+ readonly type: 'strike-through';+ } & ResolvedSharedConfig &+ ResolvedIterationConfig &+ ResolvedRtlConfig)+ | ({+ readonly type: 'box';+ } & ResolvedSharedConfig &+ ResolvedPaddingConfig &+ ResolvedIterationConfig)+ | ({+ readonly type: 'bracket';+ } & Required<BracketConfig> &+ ResolvedSharedConfig &+ ResolvedPaddingConfig)+ | ({+ readonly type: 'crossed-off';+ } & ResolvedSharedConfig &+ ResolvedIterationConfig &+ ResolvedRtlConfig)+ | ({+ readonly type: 'circle';+ readonly box: Box;+ } & ResolvedSharedConfig &+ ResolvedPaddingConfig &+ ResolvedIterationConfig)+ | ({+ readonly type: 'highlight';+ } & Omit<ResolvedSharedConfig, 'strokeWidth'> &+ ResolvedPaddingConfig &+ ResolvedIterationConfig &+ ResolvedRtlConfig);++const defaultPadding: Padding = {+ bottom: 0,+ left: 0,+ right: 0,+ top: 0,+};++const resolvePadding = (padding: Partial<Padding> | undefined): Padding => {+ return {+ ...defaultPadding,+ ...padding,+ };+};++const resolveIterations = (+ iterations: number | undefined,+ defaultIterations: number,+): number => {+ if (iterations === undefined) {+ return defaultIterations;+ }++ if (!Number.isInteger(iterations) || iterations < 1) {+ throw new TypeError('iterations must be an integer of at least 1');+ }++ return iterations;+};++const shared = ({+ color,+ strokeWidth,+ defaultStrokeWidth,+}: StrokeConfig & {+ readonly defaultStrokeWidth: number;+}) => {+ return {+ color: color ?? 'currentColor',+ strokeWidth: strokeWidth ?? defaultStrokeWidth,+ };+};++export const resolveRoughOptions = (+ options: RoughAnnotationOptions,+): RoughAnnotationOptions => {+ return Object.fromEntries(+ Object.entries(options).filter(([, value]) => value !== undefined),+ );+};++export const resolveAnnotationConfig = (+ config: AnnotationConfig,+): ResolvedAnnotationConfig => {+ if (config.type === 'none') {+ return config;+ }++ if (config.type === 'underline') {+ return {+ type: 'underline',+ ...shared({...config, defaultStrokeWidth: 20}),+ padding: resolvePadding(config.padding),+ iterations: resolveIterations(config.iterations, 2),+ rtl: config.rtl ?? false,+ };+ }++ if (config.type === 'strike-through') {+ return {+ type: 'strike-through',+ ...shared({...config, defaultStrokeWidth: 20}),+ iterations: resolveIterations(config.iterations, 1),+ rtl: config.rtl ?? false,+ };+ }++ if (config.type === 'box') {+ return {+ type: 'box',+ ...shared({...config, defaultStrokeWidth: 7}),+ padding: resolvePadding(config.padding),+ iterations: resolveIterations(config.iterations, 2),+ };+ }++ if (config.type === 'bracket') {+ return {+ type: 'bracket',+ ...shared({...config, defaultStrokeWidth: 20}),+ padding: resolvePadding(config.padding),+ bracketLeft: config.bracketLeft ?? false,+ bracketRight: config.bracketRight ?? true,+ bracketTop: config.bracketTop ?? false,+ bracketBottom: config.bracketBottom ?? false,+ };+ }++ if (config.type === 'crossed-off') {+ return {+ type: 'crossed-off',+ ...shared({...config, defaultStrokeWidth: 20}),+ iterations: resolveIterations(config.iterations, 1),+ rtl: config.rtl ?? false,+ };+ }++ if (config.type === 'circle') {+ return {+ type: 'circle',+ ...shared({...config, defaultStrokeWidth: 20}),+ padding: resolvePadding(config.padding),+ iterations: resolveIterations(config.iterations, 2),+ box: config.box ?? 'around',+ };+ }++ if (config.type === 'highlight') {+ return {+ type: 'highlight',+ color: config.color ?? 'currentColor',+ padding: resolvePadding(config.padding),+ iterations: resolveIterations(config.iterations, 2),+ rtl: config.rtl ?? false,+ };+ }++ const invalidConfig = config as {readonly type: unknown};+ throw new TypeError(+ `Unsupported annotation type: ${String(invalidConfig.type)}`,+ );+};diff --git a/packages/rough-notation/tsconfig.json b/packages/rough-notation/tsconfig.jsonnew file mode 100644index 0000000000..9832514d61--- /dev/null+++ b/packages/rough-notation/tsconfig.json@@ -0,0 +1,16 @@+{+ "extends": "../tsconfig.settings.json",+ "compilerOptions": {+ "rootDir": "src",+ "outDir": "dist",+ "jsx": "react-jsx",+ "skipLibCheck": true,+ "target": "ES2022",+ "module": "es2020",+ "moduleResolution": "bundler",+ "declaration": true,+ "emitDeclarationOnly": true+ },+ "include": ["src"],+ "references": [{"path": "../core"}, {"path": "../paths"}]+}diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.mdindex 6d142aebbb..bcbca819dc 100644--- a/packages/skills/skills/remotion-markup/SKILL.md+++ b/packages/skills/skills/remotion-markup/SKILL.md@@ -140,6 +140,10 @@ export const Subtitle = () => {See [map.md](map.md) for choosing between simple static maps, Mapbox maps, and MapLibre maps.+## Text highlights and annotations++See [text-highlights.md](text-highlights.md) for text highlights (highlight markers), circles, underlines, strike-throughs, crossed-off text, boxes, and brackets.+## VoiceoverSee [voiceover.md](voiceover.md) for adding AI-generated voiceover to Remotion compositions using ElevenLabs TTS.diff --git a/packages/skills/skills/remotion-markup/text-highlights.md b/packages/skills/skills/remotion-markup/text-highlights.mdnew file mode 100644index 0000000000..23a2ee3030--- /dev/null+++ b/packages/skills/skills/remotion-markup/text-highlights.md@@ -0,0 +1,56 @@+---+name: text-highlights+description: Animated text highlights and hand-drawn annotations using @remotion/rough-notation.+metadata:+ tags: text, highlights, annotations, circles, rough-notation+---++# Text highlights++Use `@remotion/rough-notation` to draw animated annotations around or behind text. It supports highlights, circles, underlines, strike-throughs, crossed-off text, boxes, and brackets.++Docs: https://www.remotion.dev/docs/text-highlights++Install the package using the same Remotion version as the project:++```bash+bunx remotion add @remotion/rough-notation+```++Choose the component that describes the annotation: `<Highlight>`, `<Circle>`, `<Underline>`, `<StrikeThrough>`, `<CrossedOff>`, `<Box>`, or `<Bracket>`. The component determines both the annotation style and whether it renders behind or on top of the text.++Drive `progress` from `useCurrentFrame()` so the annotation is deterministic and synchronized with the video:++```tsx+import {Circle, Highlight} from '@remotion/rough-notation';+import {interpolate, useCurrentFrame} from 'remotion';++export const TextAnnotations: React.FC = () => {+ const frame = useCurrentFrame();++ return (+ <div style={{fontSize: 80}}>+ This is{' '}+ <Highlight+ color="rgba(255, 236, 79, 0.62)"+ progress={interpolate(frame, [15, 40], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}+ >+ important+ </Highlight>+ , and this is{' '}+ <Circle color="#2563eb" progress={interpolate(frame, [15, 40], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ })}>+ connected+ </Circle>+ .+ </div>+ );+};+```++Keep `progress` inline, hardcoded and use `interpolate` for maximum [Studio interactivity](../remotion-interactivity/SKILL.md).diff --git a/packages/studio-server/src/test/compute-sequence-props-status.test.ts b/packages/studio-server/src/test/compute-sequence-props-status.test.tsindex f58732d9bd..4337c1f73e 100644--- a/packages/studio-server/src/test/compute-sequence-props-status.test.ts+++ b/packages/studio-server/src/test/compute-sequence-props-status.test.ts@@ -122,6 +122,39 @@ export const Example: React.FC = () => {).toThrow(JsxElementIdentityMismatchError);});+test('computeSequencePropsStatus should match hyphenated package imports by component identity', () => {+ const input = `import React from 'react';+import {Highlight} from '@remotion/rough-notation';++export const Example: React.FC = () => {+\treturn (+\t\t<Highlight progress={1} color="yellow">+\t\t\tHighlighted+\t\t</Highlight>+\t);+};+`;+ const result = computeSequencePropsStatusFromContent({+ fileContents: input,+ nodePath: getNodePathFromContent(input, 6),+ componentIdentity: 'dev.remotion.roughNotation.Highlight',+ keys: ['progress', 'color'],+ effects: [],+ });++ expect(result.canUpdate).toBe(true);+ if (!result.canUpdate) throw new Error('Expected canUpdate to be true');++ expect(result.props.progress).toEqual({+ status: 'static',+ codeValue: 1,+ });+ expect(result.props.color).toEqual({+ status: 'static',+ codeValue: 'yellow',+ });+});+test('computeSequencePropsStatus should match namespace imports by component identity', () => {const input = `import React from 'react';import * as Remotion from 'remotion';diff --git a/packages/studio-shared/src/package-info.ts b/packages/studio-shared/src/package-info.tsindex d2b0cf9828..fbd3a59f8a 100644--- a/packages/studio-shared/src/package-info.ts+++ b/packages/studio-shared/src/package-info.ts@@ -92,6 +92,7 @@ export const packages = ['web-renderer','design','light-leaks',+ 'rough-notation','starburst','vercel','sfx',@@ -232,6 +233,7 @@ export const descriptions: {[key in Pkgs]: string | null} = {'web-renderer': 'Render videos in the browser (not yet released)',design: 'Design system','light-leaks': 'Light leak effects for Remotion',+ 'rough-notation': 'Rough annotation primitives for Remotion','player-a11y': 'Internal accessibility wrapper around @remotion/player',starburst: 'Starburst ray effect for Remotion',vercel: 'Render Remotion videos on Vercel Sandbox',@@ -332,6 +334,7 @@ export const installableMap: {[key in Pkgs]: boolean} = {'web-renderer': false,design: false,'light-leaks': true,+ 'rough-notation': true,starburst: true,vercel: true,sfx: true,@@ -435,6 +438,7 @@ export const apiDocs: {[key in Pkgs]: string | null} = {'web-renderer': 'https://www.remotion.dev/docs/web-renderer/',design: 'https://www.remotion.dev/design','light-leaks': 'https://www.remotion.dev/docs/light-leaks',+ 'rough-notation': 'https://www.remotion.dev/docs/rough-notation',starburst: 'https://www.remotion.dev/docs/starburst',vercel: 'https://www.remotion.dev/docs/vercel/api',sfx: 'https://www.remotion.dev/docs/sfx',diff --git a/tsconfig.json b/tsconfig.jsonindex 2ccc9dfbae..549db0aab6 100644--- a/tsconfig.json+++ b/tsconfig.json@@ -264,6 +264,9 @@{"path": "./packages/light-leaks"},+ {+ "path": "./packages/rough-notation"+ },{"path": "./packages/starburst"},