UNPKG

@hiddentao/clockwork-engine

Version:

A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering

22 lines (21 loc) 538 B
/** * Bounds Calculation Utilities * * Shared functions for calculating bounds with anchor offsets. */ /** * Calculate bounds with anchor offset * * @param position Object position * @param size Object size * @param anchor Anchor point (0-1 normalized) * @returns Bounding rectangle */ export function calculateBoundsWithAnchor(position, size, anchor) { return { x: position.x - size.width * anchor.x, y: position.y - size.height * anchor.y, width: size.width, height: size.height, }; }