Input Properties
Using some JavaScript, we can do even more with these custom properties. For example, we can listen to a mouse or touch input and pass the x and y coordinates to a paint worklet. With these values, we can paint an element based on the point where the pointer is moving or the point where the pointer enters and leaves the element.
In the next exercise, we will introduce a few more custom properties and update them based on the movement of the mouse. In so doing, we will create a paint worklet that is a bit more complex but also goes beyond what is easily done with standard CSS properties (such as background-color
).