Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate card layouts automatically #225

Open
glowacki-dev opened this issue Mar 11, 2021 · 0 comments
Open

Generate card layouts automatically #225

glowacki-dev opened this issue Mar 11, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@glowacki-dev
Copy link
Member

glowacki-dev commented Mar 11, 2021

This may be an interesting issue that would require applying some simple maths knowledge. Instead of having predefined cards layouts we could have an algorithm that would generate such layouts automatically - it's basically fitting n circles (with some margin of error since pictures are actually squares 😅) into a bigger circle with a few constraints.

Inputs:

  • pictures (inner circles) count (min 6, max 12)
  • picture size (width of image) (most likely a constant 100px)
  • card size (circle diameter) (currently 300px but may be variable)
  • seed/id (if the algorithm uses any randomization it should always give the same result for the same seed, but a different results for different seeds)

Output:

  • array of objects describing parameters of each picture (that's the format we use now, but can easily be adapted):
[
  { "r": <picture rotation 0-359; this one is randomized>, "s": <picture scale 0.5-1; best looking cards seem to have both small and big pictures with very little empty space left>, "x": <x coordinate on canvas>, "y": <y coordinate on canvas> },
  ...
]

x and y coordinates are on a canvas containing the card (outer circle), so x=0, y=0 would actually place the picture outside of circle (top left)

@glowacki-dev glowacki-dev added the enhancement New feature or request label Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant