Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
Pull Circles Towards Origin without Overlapping

Right now I have a list of 5 circles. I want them to pull towards the center, but also push away from each other. I can get them to pull towards the center or push away from each other, but not both. Would love some help with this.

Some source code:

for (var i = 0; i < socials.length; i++) {
            for (var j = 0; j < socials.length; j++) {
                if (j != i) {
                    if (getDistance(socials[i].x, socials[i].y, socials[j].x, socials[j].y) < socials[i].radius + socials[j].radius + socialsPadding) {
                        socials[i].accX += (socials[i].x - socials[j].x) / 100;
                        socials[i].accY += (socials[i].y - socials[j].y) / 100;
                    }
                }
            }

            socials[i].xVel = (socialRect.width/2 - socials[i].x + socials[i].accX) / 10;
            socials[i].yVel = (socialRect.height/2 - socials[i].y + socials[i].accY) / 10;

            socials[i].x += socials[i].xVel;
            socials[i].y += socials[i].yVel;
            socials[i].radius += (socials[i].destRadius - socials[i].radius) / 10;

            socialBubbles[i].style.width = (socials[i].radius * 2) + "px";
            socialBubbles[i].style.height = (socials[i].radius * 2) + "px";
            socialBubbles[i].style.transform = "translateX(" + (socials[i].x - socials[i].radius) + "px) translateY(" + (socials[i].y - socials[i].radius) + "px)";
        }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!