The code should explain more what I am trying to do. I have multiple values as javascript variables, which are then processed through an equation to calculate the size of a circle on screen.
Currently I am repeating the equation and numbering all the variables to match the original circle number, is there a way of just running the original variable through this equation without repeating the same code for each circle?
Here is the code...
$( document ).ready(function() {
circle1 = 914;
circle2 = 600;
G1 = circle1/Math.PI;
H1 = Math.sqrt(G1);
J1 = Math.round(H1*20);
J1margin = J1/2;
$('.circle1').animate({"height":J1, "margin-top":"-"+J1margin, "width":J1, "margin-left":"-"+J1margin});
G2 = circle2/Math.PI;
H2 = Math.sqrt(G2);
J2 = Math.round(H2*20);
J2margin = J2/2;
$('.circle2').animate({"height":J2, "margin-top":"-"+J2margin, "width":J2, "margin-left":"-"+J2margin});
});// JavaScript Document
Hopefully you can see what I mean. Its probably a very easy solution but I can't word my question well enough to get an answer through Google. Thanks!