-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't workingSomething isn't workingvisualizeRelated to the visualize category, which is about drawing and illustratingRelated to the visualize category, which is about drawing and illustrating
Description
Description
Sometimes, when repeat()ing a gradient and retrieving the new gradients stops, it's not possible to feed them back into a gradient constructor.
MWE:
#let my-gradient = gradient.linear(red, blue).repeat(5)
#gradient.linear(..my-gradient.stops())The error message is "Offsets must be in strictly monotonic order".
Most interestingly, this only happens with 7,9,10,11,12,13,... repetitions. Moreoever, if the stops are hover-inspected and copied to a variable explicitly, like
#let stops = (
(rgb("#ff4136"), 0%),
(rgb("#0074d9"), 20%),
(rgb("#ff4136"), 20%),
(rgb("#0074d9"), 40%),
(rgb("#ff4136"), 40%),
(rgb("#0074d9"), 60%),
(rgb("#ff4136"), 60%),
(rgb("#0074d9"), 80%),
(rgb("#ff4136"), 80%),
(rgb("#0074d9"), 100%),
)
#gradient.linear(..stops)the issue vanishes. For this reason I assume that due to floating point errors, some offset values end off lower than others.
One a side note, looking at line
| if stop.get() < last_stop { |
Reproduction URL
No response
Operating system
No response
Typst version
- I am using the latest version of Typst
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingvisualizeRelated to the visualize category, which is about drawing and illustratingRelated to the visualize category, which is about drawing and illustrating