Hi. My intent with this is a bit complicated, but I’ll try my best to explain it, and if anyone needs clarification, please ask.
My goal is to create a vertical opacity gradient within a polygon (that is, a gradient of the opacity, where the change in opacity is vertical). What I’m trying to do is show the changes in saturation of a cloud.
My question: is this possible? I want to be able to input a value of where the opacity starts, as well as input a value of where the opacity ends (ex: opacity starts at 1.00, and opacity ends at 0.75).
Desmos has an example called Hue Gradient on one of the demo pages that seems related to what you want to accomplish. Using the same technique of combining many lines to look like a rectangle, here is a variation with an opacity gradient:
A couple drawbacks:
Setting the number of lines is dependent on screen size and zoom level. The link I provided looks like a smooth gradient on my large laptop screen but just a plain, opaque rectangle on my phone screen.
I don’t know how to adapt this technique for an arbitrary polygon. It’s straightforward for rectangles with sides parallel to the gridlines but could get complicated very quickly in other cases.
Hopefully that’s a helpful starting point! I’d love to see other solutions, too.
Take 2. Here is a more flexible approach that will work with any convex polygon: Polygon Opacity Gradient.
Instead of combining lots of lines with different opacity, it layers polygons (via systems of inequalities) to create the opacity gradient. There are a lot of calculations going on under the hood, so it runs slowly and is more suitable for creating a static graph than a dynamic interaction.
I have a similar problem. I am trying to make a polygon with a color gradient from left to right, I already have the gradient assigned, but i just don’t know how to add it. The way I would like it to act is shown next to the already made polygon, with a vertical bar.
This is the project back half: /calculator/6lwjfkyxye