Implements Gradient
Will need some extra testing and adjustment
Closes: #476
Currently world.log << gradient(list(0, "#ff0000", 1, "#000000"), 0.5) gives off #7f0000 on byond and #7f0000 on OD
Though with gradient(0, "#ff0000", 0.5, "#00ff00", 1, "#000000", 0.2) gives off #986600 on byond and #986600 on OD
Todo:
- [x] gradient(list(0, "#ff0000", 1, "#000000"), 0.5)
- [x] gradient(0, "#ff0000", 1, "#000000", 0.5)
- [x] gradient("#ff0000", "#00ff00", 0.5)
- [x] Fix issue with negative indexes
- [x] Try to use the algorithm byond uses
- [x] Remove like half this terrible code
- [x] Make sure "loop" and "space" get interpreted
- [x] Fix gradient(..., space=HSV, index) dropping the index arg
- [x] preferably support loop
- [x] Fix gradients that can have negative indexes
Closes https://github.com/wixoaGit/OpenDream/issues/476
This pull request has conflicts, please resolve those before we can evaluate the pull request.
What about
// color wheel; ranges 0 to 6 and loops
list(0, "#f00", 1, "#ff0", 2, "#0f0", 3, "#0ff", 4, "#00f", 5, "#f0f", 6, "#f00", "loop")
and
// 10% each red, yellow, green, blue, with a 20% transition zone between each
// notice no color follows 0.4 or 0.7, so the previous color is used
list(0.1, "#f00", 0.3, "#ff0", 0.4, 0.6, "#008000", 0.7, 0.9, "#00f")
What about
// color wheel; ranges 0 to 6 and loops list(0, "#f00", 1, "#ff0", 2, "#0f0", 3, "#0ff", 4, "#00f", 5, "#f0f", 6, "#f00", "loop")and
// 10% each red, yellow, green, blue, with a 20% transition zone between each // notice no color follows 0.4 or 0.7, so the previous color is used list(0.1, "#f00", 0.3, "#ff0", 0.4, 0.6, "#008000", 0.7, 0.9, "#00f")
1st one already works fine
2nd one is just what the fuck
1st one already works fine
Add a unit test for it then wink wink
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
This pull request has conflicts, please resolve those before we can evaluate the pull request.
~~I dont know what do now I have a Schrödinger bug where if I debug it, it disappears~~