I'm making a cards game in python language.
I need a formula to zooming the cards in screen.
I put the following formula by now:
zoom=(NumberOfCards*0.042857)
This formula get a zoom factor of 0.3 for Number=7. This is the standard for the first hand. Now the number of cards can increase of decrease and the hand should fit into screen accordingly.
Now I want to improve the formula to:
The screen is 1280x720. The 54 cards are saved 600x868 in png format (zoomed to 0.3 factor: 180x260.4 overlapped as you can see in the capture)
How should be the formula? I'm weak at maths, hahaha.
Thanks in advance. :-)
You can use the formula
zoom = 0.3 * (7/NumberOfCards)
to get to get the values of zoom between 0.038 (54 cards) to 2.1 (1 card).
After that, you can multiply the zoom
by a factor, so as to normalize it, and make it fall in your specific range.
For normalization, for example, to make all the values lie between 0 to 1, you can use feature scaling
X` = (X - Xmin) / (Xmax - Xmin)
In your case,
zoom` = (zoom - 0.038) / (2.1 - 0.038)
At last, add a scaling to the zoom'
value, so that zoom is not below a certain value.
zoom` = zoom` + scaling_factor