OpenDream icon indicating copy to clipboard operation
OpenDream copied to clipboard

Implements Gradient

Open redmoogle opened this issue 3 years ago • 1 comments

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

redmoogle avatar Oct 03 '22 14:10 redmoogle

Closes https://github.com/wixoaGit/OpenDream/issues/476

ike709 avatar Oct 03 '22 20:10 ike709

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Oct 29 '22 00:10 github-actions[bot]

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")

TiviPlus avatar Nov 11 '22 13:11 TiviPlus

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

redmoogle avatar Nov 11 '22 13:11 redmoogle

1st one already works fine

Add a unit test for it then wink wink

TiviPlus avatar Nov 11 '22 16:11 TiviPlus

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Nov 14 '22 00:11 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Nov 20 '22 19:11 github-actions[bot]

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Nov 26 '22 01:11 github-actions[bot]

~~I dont know what do now I have a Schrödinger bug where if I debug it, it disappears~~

redmoogle avatar Dec 13 '22 22:12 redmoogle