Skip to content

Commit aa7ac25

Browse files
committed
[css-images] Add a math hint for calculating the length of the gradient line.
1 parent d774606 commit aa7ac25

2 files changed

Lines changed: 659 additions & 552 deletions

File tree

css-images/Overview.bs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,20 @@ The linear gradient syntax is:
10591059
would intersect the corner of the <a>gradient box</a> in the specified direction.
10601060
The starting point is determined identically, but in the opposite direction.
10611061

1062+
<div class='note'>
1063+
Given:
1064+
1065+
<ul>
1066+
<li><var>A</var> the angle (in any quadrant) defining the gradient line’s direction such that 0 degrees points upwards and positive angles represent clockwise rotation,
1067+
<li><var>W</var> the width of the gradient box,
1068+
<li><var>H</var> the height of the gradient box,
1069+
</ul>
1070+
1071+
The length of the gradient line (between the <a>starting point</a> and <a>ending point</a>) is:
1072+
1073+
<code>abs(<var>W</var> * sin(<var>A</var>)) + abs(<var>H</var> * cos(<var>A</var>))</code>
1074+
</div>
1075+
10621076
Note: It is expected that the next level of this module will provide the ability to define the gradient's direction relative to the current text direction and writing-mode.
10631077

10641078
<div class=example>

0 commit comments

Comments
 (0)