-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
repeating-linear-gradient
(#630)
Now that #624 has been merged, let me bring`repeating-linear-gradient` to satori~ ❤️ Close #554 Note about the algorithm: <hr> Option 1: `0 < deg < 90` define ```math r=(h/w)^2 ``` then, calculate the intersection point of the last two lines ```math y = - r / tan(angle) ·x + w / 2 + h/2+r·w/ (2·tan(angle)) ``` ```math y=tan(angle) ·x + h ``` Finally, we can get `(x1, y1)`, `(x2, y2)` about length: ```math y = - 1 / tan(angle) ·x + w / 2 + h/2+r·w/ (2·tan(angle)) ``` ```math y=tan(angle) ·x + h ``` then, we can get a point: `(a, b)`, so length is $`2 ·\sqrt{(a - w/2)^2 + (b - h/2)^2}`$ <hr> Option 2: `90 < deg < 180` define ```math r=(h/w)^2 ``` then, calculate the intersection point of the last two lines ```math y = - r / tan(angle) ·x + w / 2 + h/2+r·w/ (2·tan(angle)) ``` ```math y=tan(angle) ·x ``` Finally, we can get `(x1, y1)`, `(x2, y2)` about length: ```math y = - 1 / tan(angle) ·x + w / 2 + h/2+r·w/ (2·tan(angle)) ``` ```math y=tan(angle) ·x ``` then, we can get a point: `(a, b)`, so length is $`2 ·\sqrt{(a - w/2)^2 + (b - h/2)^2}`$ Actually, I didn't find any spec of the algorithm on calculating the points. I just came across the algorithm accidentally. It turns out it shows the same result just like chrome renders.
- Loading branch information
1 parent
fe2534a
commit ff80448
Showing
14 changed files
with
274 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+833 Bytes
...linear-gradient-should-support-background-size-and-background-repeat-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.46 KB
...nt-test-tsx-gradient-repeating-linear-gradient-should-support-degree-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.75 KB
...nt-test-tsx-gradient-repeating-linear-gradient-should-support-degree-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+941 Bytes
...nt-test-tsx-gradient-repeating-linear-gradient-should-support-degree-3-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.72 KB
...nt-test-tsx-gradient-repeating-linear-gradient-should-support-degree-4-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+894 Bytes
...ng-linear-gradient-should-support-multiple-repeating-linear-gradient-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+471 Bytes
...t-repeating-linear-gradient-should-support-repeating-linear-gradient-1-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3 KB
...t-repeating-linear-gradient-should-support-repeating-linear-gradient-2-snap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.