import { MaskShape } from "./mask" ; export type SpriteBaseProps = { default x : number ; default y : number ; default rotation : number ; default opacity : number ; default scaleX : number ; default scaleY : number ; default anchorX : number ; default anchorY : number ; /**
     * Only render the content that fits within the outline of this shape.
     */ mask : MaskShape ; } ; /**
 * Avoid being able to use props with the same key as base props
 */ export type ExcludeSpriteBaseProps < P > = { [ K in keyof P ] : K extends keyof SpriteBaseProps ? never : P [ K ] ; } ; export function getDefaultProps ( props ) { return { x : props . x || 0 , y : props . y || 0 , rotation : props . rotation || 0 , opacity : Math . min ( 1 , Math . max ( 0 , props . opacity ?? 1 ) ) , scaleX : props . scaleX ?? 1 , scaleY : props . scaleY ?? 1 , anchorX : props . anchorX || 0 , anchorY : props . anchorY || 0 , mask : props . mask || null , } ; } export function mutateBaseProps < T extends SpriteBaseProps > ( mutProps , props ) { const toAddProps = mutProps as T ; toAddProps . x = props . x || 0 ; toAddProps . y = props . y || 0 ; toAddProps . rotation = props . rotation || 0 ; toAddProps . opacity = Math . min ( 1 , Math . max ( 0 , props . opacity ?? 1 ) ) ; toAddProps . scaleX = props . scaleX ?? 1 ; toAddProps . scaleY = props . scaleY ?? 1 ; toAddProps . anchorX = props . anchorX || 0 ; toAddProps . anchorY = props . anchorY || 0 ; toAddProps . mask = props . mask || null ; return toAddProps ; }