- Qt 6.12
- Qt Canvas Painter
- QtCanvas2D
- conicalgradient2d
- Qt Canvas Painter | Commercial or GPLv3

# conicalgradient2d QML Value Type

Provides conicalgradient2d type matching to QCanvasConicalGradient. More...

Import Statement: | `import QtCanvas2D`
Since: | Qt 6.12
Status: | Technology preview

This type is in technology preview and is subject to change.

## Methods

- void addColorStop(real offset, string color)
- real angle()
- point centerPosition()
- void setAngle(real angle)
- void setCenterPosition(real x, real y)
- void setCenterPosition(point center)

## Detailed Description

This value type is provided by the QtCanvas2D import.

See also QCanvasConicalGradient.

## Method Documentation

### void 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.createConicalGradient(100, 100, Math.PI / 2);
     gradient.addColorStop(0.0, Qt.rgba(1, 0, 0, 1));
     gradient.addColorStop(0.5, "#ff8040");
     gradient.addColorStop(1.0, "red");

### real angle()

Returns the start angle of conical gradient in radians.

See also setAngle().

### point centerPosition()

Returns the center point of conical gradient.

See also setCenterPosition().

### void setAngle(real angle)

Sets the start angle of conical gradient to angle in radians. The angle starts from a line going horizontally right from the center, and proceeds clockwise.

See also angle().

### void setCenterPosition(real x, real y)

Sets the center point of conical gradient to ( x, y).

See also centerPosition().

### void setCenterPosition(point center)

Sets the center point of conical gradient to center.

This is an overloaded function.