Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a = $("#node_2 .frame");
- var b = $("#node_1 .frame");
- var posA = $("#node_2").position();
- var posB = $("#node_1").position();
- var xA = posA.left + (a.width()+20)/2;
- var yA = posA.top + (a.height()+20)/2;
- var xB = posB.left + (b.width()+20)/2;
- var yB = posB.top + (b.height()+20)/2;
- var dy = yB-yA;
- var dx = xB-xA;
- var rad = Math.atan2(dy,dx);
- l = $("#line");
- l.width(Math.sqrt(dy*dy+dx*dx));
- l.css('top', yA+((yB-yA)/2));
- l.css('left', xA+((xB-xA)/2)-(l.width()/2));
- l.css('-moz-transform', "rotate("+rad+"rad)");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement