Canvas2DGradient QML Type
Provides an opaque Canvas2DGradient interface. More...
| Import Statement: | import QtCanvas2D |
| Since: | Qt 6.12 |
| Status: | Technology preview |
This type is in technology preview and is subject to change.
Methods
- object addColorStop(real offset, string color)
Detailed Description
Method Documentation
object addColorStop(real offset, string color)
Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
For example:
const gradient = ctx.createLinearGradient(0, 0, 100, 100);
gradient.addColorStop(0.0, Qt.rgba(1, 0, 0, 1));
gradient.addColorStop(1.0, 'rgba(0, 255, 255, 1)');