We are about to switch to a new forum software. Until then we have removed the registration on this forum.
If I use background(mouseX), it goes from black to white as I move the mouse across x but at 255 it goes from black to bright blue instead?
Up till 255, the argument value is considered as grayscale. After that, it is interpreted as an aRGB color. L-)
color
You can use map() in order to confine mouseX's width range in a grayscale range: *-:) background(round(map(mouseX, 0, width, 0, 255)));
background(round(map(mouseX, 0, width, 0, 255)));
https://Processing.org/reference/map_.html
Alternatively to map(), you can go this way too: :ar! background(mouseX * 255/width);
background(mouseX * 255/width);
Answers
Up till 255, the argument value is considered as grayscale.
After that, it is interpreted as an aRGB
color
. L-)You can use map() in order to confine mouseX's width range in a grayscale range: *-:)
background(round(map(mouseX, 0, width, 0, 255)));
https://Processing.org/reference/map_.html
Alternatively to map(), you can go this way too: :ar!
background(mouseX * 255/width);