import { AnimatedNumber, AnimatedVec2 } from "primitives/Values"; import { PropertiesProps } from "./common"; import { FC } from "react"; import { z } from "zod"; import { produce } from "immer"; import { Interpolation, InterpolationType } from "primitives/Interpolation"; import { Color, PaintStyle, PaintStyleType } from "primitives/Paint"; import { parseCssColor } from "@tempblade/common"; import { rgbToHex } from "utils"; import { SpringInterpolation } from "primitives/Interpolation"; import FloatInput from "components/Inputs/FloatInput"; import { Keyframe } from "primitives/Keyframe"; import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, } from "components/Inputs/Select"; const SpringInterpolationProperties: FC< PropertiesProps> > = ({ entity, onUpdate }) => { return
; }; export const InterpolationProperties: FC< PropertiesProps> > = ({ entity, onUpdate }) => { return (
); }; export const KeyframeProperties: FC< PropertiesProps> > = ({ entity, onUpdate }) => { return ( <>
onUpdate( produce(entity, (draft) => { draft.offset = value; }) ) } id="keyframe-offset" />
onUpdate( produce(entity, (draft) => { draft.value = value; }) ) } id="keyframe-value" />
{entity.interpolation && ( onUpdate( produce(entity, (draft) => { draft.interpolation = updatedEntity; }) ) } entity={entity.interpolation} /> )} ); }; const AnimatedNumberProperties: FC< PropertiesProps> & { label: string } > = ({ entity, onUpdate, label }) => { return (
{label} {entity.keyframes.values.map((keyframe, index) => { return (
onUpdate( produce(entity, (draft) => { draft.keyframes.values[index] = nextKeyframe; }) ) } />
); })}
); }; export const ColorProperties: FC< PropertiesProps> & { label: string; mode?: "RGB" | "Picker"; } > = ({ entity, onUpdate, mode = "Picker" }) => { if (mode === "Picker") { return (
onUpdate( produce(entity, (draft) => { const color = parseCssColor(e.target.value); if (color) { draft.value = [...color, 1.0]; } }) ) } />
); } return ( ); }; export const AnimatedVec2Properties: FC< PropertiesProps> & { label: string } > = ({ entity, onUpdate, label }) => { return (
); };