From c3dd79a7b21d4c3df2a300112bd6e09df245b5ce Mon Sep 17 00:00:00 2001 From: wangweiyuan Date: Fri, 20 Jun 2025 17:47:05 +0800 Subject: [PATCH] EffectLayer Signed-off-by: wangweiyuan --- .../ts-container-effectcomponent-sys.md | 59 +++++++++++++++++-- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-effectcomponent-sys.md b/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-effectcomponent-sys.md index 673e60d2d95..be8c2da5caf 100644 --- a/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-effectcomponent-sys.md +++ b/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-effectcomponent-sys.md @@ -20,9 +20,9 @@ ## 接口 -EffectComponent() +EffectComponent(value?: [EffectComponentOptions](#effectcomponentoptions20对象说明)): EffectComponentAttribute -创建特效绘制合并组件,用于对子组件背景模糊特效的绘制合并。 +创建特效绘制合并组件,无参数时用于对子组件背景模糊特效的绘制合并,有参数时用于充电动效绘制。 ## 事件 @@ -32,7 +32,29 @@ EffectComponent() 支持通用属性,目前仅支持对backgroundBlurStyle属性做绘制合并优化。 -## 示例 +## EffectComponentOptions20+对象说明 + +指定参数类型。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | --------------------------------------- | ---- | -------------------------------------------------------- | +| effectLayer | [EffectLayer](#effectlayer20枚举说明) | 否 | EffectComponent的渲染层级。
默认值:EffectLayer.NONE | + +## EffectLayer20+枚举说明 + +EffectComponent的渲染层级。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 值 | 说明 | +| :------------ | :--- | :----------- | +| NONE | 0 | 无特效层。 | +| CHARGE_MOTION | 1 | 充电动画层。 | +| CHARGE_TEXT | 2 | 充电文字层。 | + +## 示例1 该示例主要演示如何使用特效绘制合并组件。 @@ -98,4 +120,33 @@ struct Index { } ``` -![zh-cn_image_effectcomponent](figures/zh-cn_image_effectcomponent.png) \ No newline at end of file +![zh-cn_image_effectcomponent](figures/zh-cn_image_effectcomponent.png) + +## 示例2 + +该示例主要演示如何渲染充电文字层。 + +```ts +@Entry +@Component +struct Index { + build() { + Stack() { + Image($r("app.media.startIcon")) + .autoResize(true) + EffectComponent({effectLayer: EffectLayer.CHARGE_TEXT}) { + Text('CHARGE_TEXT') + .height('50%') + .width('100%') + .fontSize(50) + .textAlign(TextAlign.Center); + } + .backgroundBlurStyle(BlurStyle.Thin) + } + .backgroundColor(Color.Black) + .width('100%') + .height('100%') + } +} +``` + -- Gitee