Skip to content

Instantly share code, notes, and snippets.

@audinue
Created August 6, 2023 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audinue/3ccf48fceecc5663849faa8b9d7d2182 to your computer and use it in GitHub Desktop.
Save audinue/3ccf48fceecc5663849faa8b9d7d2182 to your computer and use it in GitHub Desktop.
Alignment Formula:
itemLocation = containerLocation + containerSize * alignmentFactor - itemSize * alignmentFactor
item.x = container.x + container.width * alignment.x - item.width * alignment.x
item.y = container.y + container.height * alignment.y - item.height * alignment.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment