A
A
Aleksandr2017-03-24 16:27:46
JavaScript
Aleksandr, 2017-03-24 16:27:46

Animating the random position of an element?

Hello. The second day I'm scratching my head.
How can I ensure that the elements do not touch each other?
Here is an example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2017-03-24
@healqq

If you do have circles, then the touch condition is:
Distance(C1, C2) = R1 + R2, where C1 and C2 are the centers of the circles, R1 and R2 are the radii.
In the simplest case - check each with each at each tick. If there are too many circles, use some existing algorithms.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question