From 69b2c4c5445ddd3aeb29e14ed254d547e94b627b Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Tue, 16 Sep 2025 20:46:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9EFAQ=E5=90=8C=E6=BA=90?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/pages/FontGradientPlanTwo.ets | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ArkUI/entry/src/main/ets/pages/FontGradientPlanTwo.ets diff --git a/ArkUI/entry/src/main/ets/pages/FontGradientPlanTwo.ets b/ArkUI/entry/src/main/ets/pages/FontGradientPlanTwo.ets new file mode 100644 index 00000000..c4c9d7c3 --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/FontGradientPlanTwo.ets @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2024 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/** + * FAQ:如何实现字体渐变效果 + */ + +// [Start font_gradient] +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + RelativeContainer() { + Text(this.message) + .fontSize(24) + .fontWeight(FontWeight.Bold) + .shaderStyle({ + direction: GradientDirection.Right, + colors: [['#ff0631f5', 0.0], ['#ff922626', 1]] + }) + } + .width('100%') + .height('100%') + } +} + +// [End font_gradient] \ No newline at end of file -- Gitee