@@ -237,6 +237,7 @@ function parseNumericOrString(raw: string): number | string {
237237
238238interface AnimationCardProps {
239239 animation : GsapAnimation ;
240+ elementStart ?: number ;
240241 defaultExpanded : boolean ;
241242 onUpdateProperty : ( animationId : string , property : string , value : number | string ) => void ;
242243 onUpdateMeta : (
@@ -265,6 +266,7 @@ interface AnimationCardProps {
265266// fallow-ignore-next-line complexity
266267export const AnimationCard = memo ( function AnimationCard ( {
267268 animation,
269+ elementStart = 0 ,
268270 defaultExpanded,
269271 onUpdateProperty,
270272 onUpdateMeta,
@@ -342,9 +344,9 @@ export const AnimationCard = memo(function AnimationCard({
342344 ( raw : string ) => {
343345 const num = Number ( raw ) ;
344346 if ( Number . isFinite ( num ) && num >= 0 )
345- onUpdateMeta ( animation . id , { position : Math . max ( 0 , num ) } ) ;
347+ onUpdateMeta ( animation . id , { position : Math . max ( 0 , num - elementStart ) } ) ;
346348 } ,
347- [ animation . id , onUpdateMeta ] ,
349+ [ animation . id , elementStart , onUpdateMeta ] ,
348350 ) ;
349351
350352 const [ copied , setCopied ] = useState ( false ) ;
@@ -354,10 +356,12 @@ export const AnimationCard = memo(function AnimationCard({
354356 const easeLabel = easeName . startsWith ( "custom(" )
355357 ? "Custom curve"
356358 : ( EASE_LABELS [ easeName ] ?? easeName ) ;
359+ const absolutePosition =
360+ typeof animation . position === "number" ? animation . position + elementStart : animation . position ;
357361 const endTime =
358- typeof animation . position === "number"
359- ? animation . position + ( animation . duration ?? 0 )
360- : animation . position ;
362+ typeof absolutePosition === "number"
363+ ? absolutePosition + ( animation . duration ?? 0 )
364+ : absolutePosition ;
361365
362366 const summary = useMemo ( ( ) => buildTweenSummary ( animation ) , [ animation ] ) ;
363367
@@ -375,9 +379,9 @@ export const AnimationCard = memo(function AnimationCard({
375379 { methodLabel }
376380 </ span >
377381 < span className = "text-[11px] font-medium text-neutral-400" title = "When this effect plays" >
378- { typeof animation . position === "number"
379- ? `${ parseFloat ( animation . position . toFixed ( 3 ) ) } s`
380- : animation . position } { " " }
382+ { typeof absolutePosition === "number"
383+ ? `${ parseFloat ( absolutePosition . toFixed ( 3 ) ) } s`
384+ : absolutePosition } { " " }
381385 – { typeof endTime === "number" ? `${ parseFloat ( endTime . toFixed ( 3 ) ) } s` : endTime }
382386 </ span >
383387 < span className = "ml-auto text-[10px] text-neutral-500" title = { easeName } >
@@ -439,11 +443,11 @@ export const AnimationCard = memo(function AnimationCard({
439443 < MetricField
440444 label = "Starts at"
441445 value = {
442- typeof animation . position === "string"
443- ? animation . position
444- : String ( parseFloat ( Math . max ( 0 , animation . position ) . toFixed ( 3 ) ) )
446+ typeof absolutePosition === "string"
447+ ? absolutePosition
448+ : String ( parseFloat ( Math . max ( 0 , absolutePosition ) . toFixed ( 3 ) ) )
445449 }
446- suffix = { typeof animation . position === "number" ? "s" : undefined }
450+ suffix = { typeof absolutePosition === "number" ? "s" : undefined }
447451 tooltip = "When this effect begins on the timeline"
448452 onCommit = { commitPosition }
449453 />
0 commit comments