diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index abba7c987d32cb45c0fe1513c0d8adeb02a7cc33..934cb61fd75f6508e22d0f10c88507c1ce9c01bc 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -1,7 +1,9 @@ # Gradient Color +Create a more gorgeous look for a component by applying a gradient color effect to it. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -15,31 +17,32 @@ None | Name | Type | Default Value | Description | | -------- | -------- | -------- | -------- | -| linearGradient | {
angle?: [Angle](../../ui/ts-types.md),
direction?:GradientDirection,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | Linear gradient.
**angle**: angle of the linear gradient.
**direction**: direction of the linear gradient.
**colors**: description of the gradient colors.
**repeating**: whether the colors are repeated. | +| linearGradient | {
angle?: [Angle](../../ui/ts-types.md),
direction?:GradientDirection,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | Linear gradient.
**angle**: angle of the linear gradient.
**direction**: direction of the linear gradient. It does not take effect when **angle** is set.
**colors**: description of the gradient colors.
**repeating**: whether the colors are repeated. | | sweepGradient | {
center: Point,
start?: angle,
end?: angle,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating?: boolean
} | - | Angle gradient.
**center**: center point of the angle gradient.
**start**: start point of the angle gradient.
**end**: end point of the angle gradient.
**colors**: description of the gradient colors.
**repeating**: whether the colors are repeated. | | radialGradient | {
center: Point,
radius: Length,
colors: Array<[ColorStop](../../ui/ts-types.md)>
repeating: boolean
} | - | Radial gradient.
**center**: center point of the radial gradient.
**radius**: radius of the radial gradient.
**colors**: description of the gradient colors.
**repeating**: whether the colors are repeated. | +- GradientDirection -- GradientDirection enums - **GradientDirection** is used to describe the gradient direction. + Enumerates the gradient directions. - | Name | Description | + | Name | Description | | -------- | -------- | - | Left | The gradient direction is from right to left. | - | Top | The gradient direction is from bottom to top. | - | Right | The gradient direction is from left to right. | - | Bottom | The gradient direction is from top to bottom. | - | LeftTop | The gradient direction is upper left. | - | LeftBottom | The gradient direction is lower left. | - | RightTop | The gradient direction is upper right. | - | RightBottom | The gradient direction is lower right. | - | None | No gradient. | + | Left | The gradient direction is from right to left. | + | Top | The gradient direction is from bottom to top. | + | Right | The gradient direction is from left to right. | + | Bottom | The gradient direction is from top to bottom. | + | LeftTop | The gradient direction is upper left. | + | LeftBottom | The gradient direction is lower left. | + | RightTop | The gradient direction is upper right. | + | RightBottom | The gradient direction is lower right. | + | None | No gradient. | ## Example -``` +```ts +// xxx.ets @Entry @Component struct ColorGradientExample { @@ -51,7 +54,6 @@ struct ColorGradientExample { .height(50) .linearGradient({ angle: 90, - direction: GradientDirection.Left, colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] }) Text('sweepGradient').fontSize(12).width('90%').fontColor(0xCCCCCC)