YellowWarningTriangle.png This wiki is closed in favour of the new wiki. Information shown is likely to be very out of date.

Difference between revisions of "User:Space/Template:DrawLine"

From Discovery Wiki
Jump to navigationJump to search
m
m (Possible lazy fix)
Line 3: Line 3:
 
bottom:{{{2}}}px;
 
bottom:{{{2}}}px;
 
transform-origin: -1% -50%;
 
transform-origin: -1% -50%;
transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi}}deg);
+
transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi+90}}deg);
 
-webkit-transform-origin: -1% -50%;
 
-webkit-transform-origin: -1% -50%;
-webkit-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi}}deg);
+
-webkit-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi+90}}deg);
 
-ms-transform-origin: -1% -50%;
 
-ms-transform-origin: -1% -50%;
-ms-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi}}deg);
+
-ms-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi+90}}deg);
 
-moz-transform-origin: -1% -50%;
 
-moz-transform-origin: -1% -50%;
-moz-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi}}deg);
+
-moz-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi+90}}deg);
 
-o-transform-origin: -1% -50%;
 
-o-transform-origin: -1% -50%;
-o-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/pi}}deg);
+
-o-transform:rotate({{#expr:({{atan2|y={{#expr:{{{4}}}-{{{2}}}}}|x={{#expr:{{{3}}}-{{{1}}}}}}})*180/+90pi}}deg);
 
width: {{#expr: (({{{3}}}-{{{1}}})^2+({{{4}}}-{{{2}}})^2)^0.5}}px;
 
width: {{#expr: (({{{3}}}-{{{1}}})^2+({{{4}}}-{{{2}}})^2)^0.5}}px;
 
height: {{{5}}}px;
 
height: {{{5}}}px;

Revision as of 20:24, 8 April 2013


150px-WIP2.png This page is currently being developed by one or more editors being led by Space. Please refer to the talk page to learn about and/or contribute to the completion of this page. You can also contact the leader on their discussion page.

Talk Page

To-do

  • Make a formula for generating a percentage for the transform-origin x value which always places the pivot point of the line at (width/2) in from the short side, i.e. (width/2) pixels in on the symmetry line of the div

Usage

{{User:Space/Template:DrawLine|x1|y1|x2|y2|width in px|valid css color code or name}}

Planned to be used for trade lanes in Template:System Map.

Result

{{User:Space/Template:DrawLine|200|200|300|100|3|purple}}{{User:Space/Template:DrawLine|100|0|0|100|3|pink}}{{User:Space/Template:DrawLine|0|100|100|0|3|yellow}}{{User:Space/Template:DrawLine|0|0|100|100|3|#00BFFF}}{{User:Space/Template:DrawLine|0|0|100|-100|3|orange}}{{User:Space/Template:DrawLine|100|-200|400|-1000|3|orange}}{{User:Space/Template:DrawLine|0|0|-100|100|3|green}}{{User:Space/Template:DrawLine|0|0|-100|-100|3|black}}{{User:Space/Template:DrawLine|7000|-10000|800|1300|40|red}} (and a bunch of newlines)





<div style="position:relative; x= left:200px; bottom:200px; transform-origin: -1% -50%; transform:rotate(45deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(45deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(45deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(45deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: purple;">

<div style="position:relative; x= left:100px; bottom:0px; transform-origin: -1% -50%; transform:rotate(225deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(225deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(225deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(225deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: pink;">

<div style="position:relative; x= left:0px; bottom:100px; transform-origin: -1% -50%; transform:rotate(45deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(45deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(45deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(45deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: yellow;">

<div style="position:relative; x= left:0px; bottom:0px; transform-origin: -1% -50%; transform:rotate(135deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(135deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(135deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(135deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: #00BFFF;">

<div style="position:relative; x= left:0px; bottom:0px; transform-origin: -1% -50%; transform:rotate(45deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(45deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(45deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(45deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: orange;">

<div style="position:relative; x= left:100px; bottom:-100px; transform-origin: -1% -50%; transform:rotate(18.434948822919deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(18.434948822919deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(18.434948822919deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(18.434948822919deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 948.68329805051px; height: 3px;

background: orange;">

<div style="position:relative; x= left:0px; bottom:0px; transform-origin: -1% -50%; transform:rotate(225deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(225deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(225deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(225deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: green;">

<div style="position:relative; x= left:0px; bottom:0px; transform-origin: -1% -50%; transform:rotate(-44.999999999997deg); -webkit-transform-origin: -1% -50%; -webkit-transform:rotate(-44.999999999997deg); -ms-transform-origin: -1% -50%; -ms-transform:rotate(-44.999999999997deg); -moz-transform-origin: -1% -50%; -moz-transform:rotate(-44.999999999997deg); -o-transform-origin: -1% -50%; -o-transform:rotate(Expression error: Unexpected number.deg); width: 141.42135623731px; height: 3px;

background: black;">