Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     var a = $("#node_2 .frame");
  2.     var b = $("#node_1 .frame");
  3.     var posA = $("#node_2").position();
  4.     var posB = $("#node_1").position();
  5.     var xA = posA.left + (a.width()+20)/2;
  6.     var yA = posA.top + (a.height()+20)/2;
  7.     var xB = posB.left + (b.width()+20)/2;
  8.     var yB = posB.top + (b.height()+20)/2;
  9.     var dy = yB-yA;
  10.     var dx = xB-xA;
  11.     var rad = Math.atan2(dy,dx);
  12.     l = $("#line");
  13.     l.width(Math.sqrt(dy*dy+dx*dx));
  14.     l.css('top', yA+((yB-yA)/2));
  15.     l.css('left', xA+((xB-xA)/2)-(l.width()/2));
  16.     l.css('-moz-transform', "rotate("+rad+"rad)");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement