Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): text segment style, animation, and layout model in the editor

Richie McIlroyc97da2926030
diff --git a/apps/desktop/src/routes/editor/text-style.tsx b/apps/desktop/src/routes/editor/text-style.tsx
index dd884200c..ef08a8746 100644
--- a/apps/desktop/src/routes/editor/text-style.tsx
+++ b/apps/desktop/src/routes/editor/text-style.tsx
@@ -7,6 +7,7 @@ import type { OrganizationBrandColorSwatch } from "~/utils/organization-branding
import { BrandColorsDropdown } from "./BrandColorsDropdown";
import { getColorPreviewBorderColor } from "./color-utils";
import { TextInput } from "./TextInput";
+import type { TextAnimation } from "./text";
export const FONT_OPTIONS = [
{ value: "System Sans-Serif", label: "System Sans-Serif" },
@@ -39,6 +40,28 @@ export const TEXT_WEIGHT_OPTIONS = [
{ label: "Bold", value: 700 },
];
+export const TEXT_SEGMENT_WEIGHT_OPTIONS = [
+ { label: "Light", value: 300 },
+ { label: "Regular", value: 400 },
+ { label: "Medium", value: 500 },
+ { label: "Semibold", value: 600 },
+ { label: "Bold", value: 700 },
+ { label: "Extra Bold", value: 800 },
+ { label: "Black", value: 900 },
+];
+
+export const TEXT_ANIMATION_OPTIONS: {
+ value: TextAnimation;
+ label: string;
+}[] = [
+ { value: "none", label: "None" },
+ { value: "fade", label: "Fade" },
+ { value: "slideUp", label: "Slide up" },
+ { value: "slideDown", label: "Slide down" },
+ { value: "pop", label: "Pop" },
+ { value: "typewriter", label: "Typewriter" },
+];
+
export const CAPTION_ANIMATION_OPTIONS = [
{ value: "none", label: "None" },
{ value: "bounce", label: "Bounce" },
diff --git a/apps/desktop/src/routes/editor/text.ts b/apps/desktop/src/routes/editor/text.ts
index a8cc1e449..bf791e95b 100644
--- a/apps/desktop/src/routes/editor/text.ts
+++ b/apps/desktop/src/routes/editor/text.ts
@@ -7,6 +7,18 @@ export const TEXT_REFERENCE_HEIGHT = 1080;
export const TEXT_FONT_SIZE_MIN = 8;
export const TEXT_FONT_SIZE_MAX = 400;
+export type TextAlign = "left" | "center" | "right";
+
+export type TextAnimation =
+ | "none"
+ | "fade"
+ | "slideUp"
+ | "slideDown"
+ | "pop"
+ | "typewriter";
+
+export type TextLayout = "overlay" | "fullscreen" | "splitLeft" | "splitRight";
+
export type TextSegment = {
start: number;
end: number;
@@ -21,6 +33,17 @@ export type TextSegment = {
italic: boolean;
color: string;
fadeDuration: number;
+ align: TextAlign;
+ letterSpacing: number;
+ lineHeight: number;
+ opacity: number;
+ shadow: number;
+ animationIn: TextAnimation;
+ animationOut: TextAnimation;
+ animationInDuration: number;
+ animationOutDuration: number;
+ layout: TextLayout;
+ layoutTransition: number;
};
// Picks the starting colour for a new text segment by sampling the composited
@@ -98,4 +121,15 @@ export const defaultTextSegment = (
italic: false,
color: "#ffffff",
fadeDuration: 0.15,
+ align: "center",
+ letterSpacing: 0,
+ lineHeight: 1.2,
+ opacity: 1,
+ shadow: 0,
+ animationIn: "fade",
+ animationOut: "fade",
+ animationInDuration: 0.15,
+ animationOutDuration: 0.15,
+ layout: "overlay",
+ layoutTransition: 0.5,
});