Great, thanks! I thought something like that might work, but last night I was too exhausted after writing the rest of my code to figure it out. Thanks for filling in the various cross-browser CSS codes as well.
For anyone else looking for a similar answer, here's everything worked out in a little more detail:
1. Calculate start points and end points, however that works on your page. (Hopefully that's just x and y values for each, within one region on the page-- not as complex as my page is right now, haha-- but I'll still get it there, just with a few more steps.)
2. Convert the ordered pair of points to an angle for the line (fun trigonometry! rise over run and all that...).
3. Calculate the distance from point1 to point2-- pythagorean equation (again, rise and run for the sides and calculate the hypotenuse).
3. Dynamically set the values for the HTML and CSS below:
Code:
hr
{
/*Replace 5 below with whatever angle you calculated*/
transform:rotate(5deg);
-ms-transform:rotate(5deg);
-moz-transform:rotate(5deg);
-webkit-transform:rotate(5deg);
-o-transform:rotate(5deg);
}
--------------
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--Replace width of 50 with length; top of 80 with height-y; and left of 20 with x-->
<hr style="width:50px;position:absolute;top:80px;left:20px;">
</body>
</html>
And now for some trigonometry to get it setup on my page.
EDIT: There's a problem. I'll need to test it further. The rotation is going to be based on the center of the object, I expect. Therefore, it will be necessary to slide it up half of the rise (or down if rise is negative) and over (half length - half of the run) to move it to be attached to the starting point at one end-- I'll play with this later.
Bookmarks