refactor: move rendering primitives into model
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ab982b888e
commit
02d957582b
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Effect } from "@/model/decorations/effect";
|
import type { Effect } from "@/model/decorations/effect";
|
||||||
import type { Mask } from "@/model/decorations/mask";
|
import type { Mask } from "@/model/decorations/mask";
|
||||||
import type { ParamValues } from "@/model/decorations/param-values";
|
import type { ParamValues } from "@/model/decorations/param-values";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { BaseTimelineElement } from "./base";
|
import type { BaseTimelineElement } from "./base";
|
||||||
|
|
||||||
export interface GraphicElement extends BaseTimelineElement {
|
export interface GraphicElement extends BaseTimelineElement {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Effect } from "@/model/decorations/effect";
|
import type { Effect } from "@/model/decorations/effect";
|
||||||
import type { Mask } from "@/model/decorations/mask";
|
import type { Mask } from "@/model/decorations/mask";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { BaseTimelineElement } from "./base";
|
import type { BaseTimelineElement } from "./base";
|
||||||
|
|
||||||
export interface ImageElement extends BaseTimelineElement {
|
export interface ImageElement extends BaseTimelineElement {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import type { ImageElement } from "./image";
|
||||||
import type { StickerElement } from "./sticker";
|
import type { StickerElement } from "./sticker";
|
||||||
import type { TextElement } from "./text";
|
import type { TextElement } from "./text";
|
||||||
import type { VideoElement } from "./video";
|
import type { VideoElement } from "./video";
|
||||||
import type { Transform } from "@/rendering";
|
import type { Transform } from "@/model/rendering";
|
||||||
|
|
||||||
export * from "./audio";
|
export * from "./audio";
|
||||||
export * from "./base";
|
export * from "./base";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Effect } from "@/model/decorations/effect";
|
import type { Effect } from "@/model/decorations/effect";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { BaseTimelineElement } from "./base";
|
import type { BaseTimelineElement } from "./base";
|
||||||
|
|
||||||
export interface StickerElement extends BaseTimelineElement {
|
export interface StickerElement extends BaseTimelineElement {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Effect } from "@/model/decorations/effect";
|
import type { Effect } from "@/model/decorations/effect";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { BaseTimelineElement } from "./base";
|
import type { BaseTimelineElement } from "./base";
|
||||||
|
|
||||||
export interface TextBackground {
|
export interface TextBackground {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Effect } from "@/model/decorations/effect";
|
import type { Effect } from "@/model/decorations/effect";
|
||||||
import type { Mask } from "@/model/decorations/mask";
|
import type { Mask } from "@/model/decorations/mask";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { BaseTimelineElement, RetimeConfig } from "./base";
|
import type { BaseTimelineElement, RetimeConfig } from "./base";
|
||||||
|
|
||||||
export interface VideoElement extends BaseTimelineElement {
|
export interface VideoElement extends BaseTimelineElement {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ export * from "./decorations";
|
||||||
export * from "./element-ref";
|
export * from "./element-ref";
|
||||||
export * from "./elements";
|
export * from "./elements";
|
||||||
export * from "./ids";
|
export * from "./ids";
|
||||||
|
export * from "./rendering";
|
||||||
export * from "./scene";
|
export * from "./scene";
|
||||||
export * from "./time";
|
export * from "./time";
|
||||||
export * from "./track";
|
export * from "./track";
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,28 @@
|
||||||
export interface Transform {
|
export interface Transform {
|
||||||
scaleX: number;
|
scaleX: number;
|
||||||
scaleY: number;
|
scaleY: number;
|
||||||
position: {
|
position: {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
};
|
};
|
||||||
rotate: number;
|
rotate: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BlendMode =
|
export type BlendMode =
|
||||||
| "normal"
|
| "normal"
|
||||||
| "darken"
|
| "darken"
|
||||||
| "multiply"
|
| "multiply"
|
||||||
| "color-burn"
|
| "color-burn"
|
||||||
| "lighten"
|
| "lighten"
|
||||||
| "screen"
|
| "screen"
|
||||||
| "plus-lighter"
|
| "plus-lighter"
|
||||||
| "color-dodge"
|
| "color-dodge"
|
||||||
| "overlay"
|
| "overlay"
|
||||||
| "soft-light"
|
| "soft-light"
|
||||||
| "hard-light"
|
| "hard-light"
|
||||||
| "difference"
|
| "difference"
|
||||||
| "exclusion"
|
| "exclusion"
|
||||||
| "hue"
|
| "hue"
|
||||||
| "saturation"
|
| "saturation"
|
||||||
| "color"
|
| "color"
|
||||||
| "luminosity";
|
| "luminosity";
|
||||||
|
|
@ -18,7 +18,7 @@ import {
|
||||||
type PreviewSnapLine,
|
type PreviewSnapLine,
|
||||||
} from "@/preview/preview-snap";
|
} from "@/preview/preview-snap";
|
||||||
import type { TCanvasSize } from "@/project/types";
|
import type { TCanvasSize } from "@/project/types";
|
||||||
import type { Transform } from "@/rendering";
|
import type { Transform } from "@/model/rendering";
|
||||||
import { isVisualElement } from "@/timeline/element-utils";
|
import { isVisualElement } from "@/timeline/element-utils";
|
||||||
import type { ElementRef, SceneTracks, TextElement, TimelineElement, TimelineTrack, VisualElement } from "@/model";
|
import type { ElementRef, SceneTracks, TextElement, TimelineElement, TimelineTrack, VisualElement } from "@/model";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
setChannel,
|
setChannel,
|
||||||
} from "@/animation";
|
} from "@/animation";
|
||||||
import type { ElementAnimations } from "@/model/decorations/animations";
|
import type { ElementAnimations } from "@/model/decorations/animations";
|
||||||
import type { Transform } from "@/rendering";
|
import type { Transform } from "@/model/rendering";
|
||||||
import { resolveTransformAtTime } from "@/rendering/animation-values";
|
import { resolveTransformAtTime } from "@/rendering/animation-values";
|
||||||
import type { ElementRef, SceneTracks, TimelineElement, VisualElement } from "@/model";
|
import type { ElementRef, SceneTracks, TimelineElement, VisualElement } from "@/model";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import type { ElementAnimations } from "@/model/decorations/animations";
|
import type { ElementAnimations } from "@/model/decorations/animations";
|
||||||
import { resolveAnimationPathValueAtTime } from "@/animation";
|
import { resolveAnimationPathValueAtTime } from "@/animation";
|
||||||
import type { Transform } from "./index";
|
import type { Transform } from "@/model/rendering";
|
||||||
|
|
||||||
export function resolveTransformAtTime({
|
export function resolveTransformAtTime({
|
||||||
baseTransform,
|
baseTransform,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ import {
|
||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
SelectValue,
|
SelectValue,
|
||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import type { BlendMode } from "@/rendering";
|
import type { BlendMode } from "@/model/rendering";
|
||||||
import type { ElementType } from "@/model";
|
import type { ElementType } from "@/model";
|
||||||
import type { ElementAnimations } from "@/model/decorations/animations";
|
import type { ElementAnimations } from "@/model/decorations/animations";
|
||||||
import { HugeiconsIcon } from "@hugeicons/react";
|
import { HugeiconsIcon } from "@hugeicons/react";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { BlendMode } from "@/rendering";
|
import type { BlendMode } from "@/model/rendering";
|
||||||
import type { EffectPass } from "@/model/decorations/effect";
|
import type { EffectPass } from "@/model/decorations/effect";
|
||||||
|
|
||||||
export type FrameDescriptor = {
|
export type FrameDescriptor = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { BaseNode } from "./base-node";
|
import { BaseNode } from "./base-node";
|
||||||
import type { TextElement } from "@/model";
|
import type { TextElement } from "@/model";
|
||||||
import type { EffectPass } from "@/model/decorations/effect";
|
import type { EffectPass } from "@/model/decorations/effect";
|
||||||
import type { Transform } from "@/rendering";
|
import type { Transform } from "@/model/rendering";
|
||||||
import { drawMeasuredTextLayout } from "@/text/primitives";
|
import { drawMeasuredTextLayout } from "@/text/primitives";
|
||||||
import type { MeasuredTextElement } from "@/text/measure-element";
|
import type { MeasuredTextElement } from "@/text/measure-element";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { BaseNode } from "./base-node";
|
import { BaseNode } from "./base-node";
|
||||||
import type { Effect, EffectPass } from "@/model/decorations/effect";
|
import type { Effect, EffectPass } from "@/model/decorations/effect";
|
||||||
import type { Mask } from "@/model/decorations/mask";
|
import type { Mask } from "@/model/decorations/mask";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { RetimeConfig, VisualElement } from "@/model";
|
import type { RetimeConfig, VisualElement } from "@/model";
|
||||||
|
|
||||||
export interface VisualNodeParams {
|
export interface VisualNodeParams {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { DEFAULT_NEW_ELEMENT_DURATION } from "@/timeline/creation";
|
import { DEFAULT_NEW_ELEMENT_DURATION } from "@/timeline/creation";
|
||||||
import type { TTimelineViewState } from "@/project/types";
|
import type { TTimelineViewState } from "@/project/types";
|
||||||
import type { BlendMode, Transform } from "@/rendering";
|
import type { BlendMode, Transform } from "@/model/rendering";
|
||||||
import type { TextElement } from "@/model";
|
import type { TextElement } from "@/model";
|
||||||
|
|
||||||
const defaultTransform: Transform = {
|
const defaultTransform: Transform = {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import {
|
||||||
type VideoElement,
|
type VideoElement,
|
||||||
type VideoTrack,
|
type VideoTrack,
|
||||||
} from "@/model";
|
} from "@/model";
|
||||||
import type { Transform } from "@/rendering";
|
import type { Transform } from "@/model/rendering";
|
||||||
import { resolveTrackPlacement } from "@/timeline/placement";
|
import { resolveTrackPlacement } from "@/timeline/placement";
|
||||||
|
|
||||||
function buildTransform(): Transform {
|
function buildTransform(): Transform {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue