A
A
Alexey Strukov2016-10-30 22:14:42
JavaScript
Alexey Strukov, 2016-10-30 22:14:42

Is there a way to make canvas responsive?

Welcome all!
Who has experience with canvas, can you please tell me if it is possible to make it adaptive?
There is, for example, a 500 x 500 pixel canvas. On it, let's say there are 10 circles with a diameter of 100 pixels, which randomly float on the canvas. It is necessary to make it so that when the screen is reduced, the circles also proportionally or adaptively decrease.
What are the options?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Suntsev, 2016-10-30
@pm_wanderer

Set the variable to which you send the width of the screen, and from this proportionally reduce the elements.

X
xmoonlight, 2016-10-31
@xmoonlight

In general, something like this:
58bbf8ffc8a2454b9e4e52b49f063888.gif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question