当前位置: 首页 > news >正文

重庆网站定制哪家好开车搜索关键词

重庆网站定制哪家好,开车搜索关键词,自做跨境电商网站收款,简道云crm【引言】#xff08;完整代码在最后面#xff09; 本文将介绍如何在鸿蒙NEXT中创建一个自定义的“太极Loading”组件#xff0c;为你的应用增添独特的视觉效果。 【环境准备】 电脑系统#xff1a;windows 10 开发工具#xff1a;DevEco Studio NEXT Beta1 Build Vers… 【引言】完整代码在最后面 本文将介绍如何在鸿蒙NEXT中创建一个自定义的“太极Loading”组件为你的应用增添独特的视觉效果。 【环境准备】 电脑系统windows 10 开发工具DevEco Studio NEXT Beta1 Build Version: 5.0.3.806 工程版本API 12 真机mate60 pro 语言ArkTS、ArkUI 【项目分析】 1. 组件结构 我们将创建一个名为 TaiChiLoadingProgress 的自定义组件它将模拟太极图的旋转效果作为加载动画展示给用户。组件的基本结构如下 Component struct TaiChiLoadingProgress {Prop taiChiWidth: number 400Prop Watch(animationCurveChanged) animationCurve: Curve Curve.LinearState angle: number 0State cellWidth: number 0... }2. 绘制太极图案 使用鸿蒙NEXT提供的UI组件如 Rect 和 Circle构建太极图的黑白两部分。关键在于利用 rotate 方法实现太极图的旋转效果。 build() {Stack() {Stack() {// 黑色半圆背景Stack() {Rect().width(${this.cellWidth}px).height(${this.cellWidth / 2}px).backgroundColor(Color.Black)}.width(${this.cellWidth}px).height(${this.cellWidth}px).rotate({ angle: -90 }).align(Alignment.Top)// 大黑球 上Stack() {Circle().width(${this.cellWidth / 2}px).height(${this.cellWidth / 2}px).fill(Color.Black)Circle().width(${this.cellWidth / 8}px).height(${this.cellWidth / 8}px).fill(Color.White)}.width(${this.cellWidth}px).height(${this.cellWidth}px).align(Alignment.Top)// 大白球 下Stack() {Circle().width(${this.cellWidth / 2}px).height(${this.cellWidth / 2}px).fill(Color.White)Circle().width(${this.cellWidth / 8}px).height(${this.cellWidth / 8}px).fill(Color.Black)}.width(${this.cellWidth}px).height(${this.cellWidth}px).align(Alignment.Bottom)}.width(${this.cellWidth}px).height(${this.cellWidth}px).borderWidth(1).borderColor(Color.Black).borderRadius(50%).backgroundColor(Color.White).clip(true).rotate({angle: this.angle}).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) {if (isVisible currentRatio 1.0) {this.startAnim()}if (!isVisible currentRatio 0.0) {this.endAnim()}})}.width(${this.taiChiWidth}px).height(${this.taiChiWidth}px) }3. 动画实现 通过 animateTo 方法设置太极图的旋转动画可以自定义动画曲线以实现不同的动画效果。 startAnim() {animateTo({duration: 2000,iterations: -1,curve: this.animationCurve}, () {this.angle 360 * 2}) }endAnim() {animateTo({duration: 0}, () {this.angle 0}) }【完整代码】 Component struct TaiChiLoadingProgress {Prop taiChiWidth: number 400Prop Watch(animationCurveChanged) animationCurve: Curve Curve.LinearState angle: number 0State cellWidth: number 0animationCurveChanged() {this.endAnim()this.startAnim()}startAnim() {animateTo({duration: 2000,iterations: -1,curve: this.animationCurve}, () {this.angle 360 * 2})}endAnim() {animateTo({duration: 0}, () {this.angle 0})}aboutToAppear(): void {this.cellWidth this.taiChiWidth / 2}build() {Stack() {Stack() {//黑色 半圆 背景Stack() {Rect().width(${this.cellWidth}px).height(${this.cellWidth / 2}px).backgroundColor(Color.Black)}.width(${this.cellWidth}px).height(${this.cellWidth}px).rotate({ angle: -90 }).align(Alignment.Top)//大黑球 上Stack() {Stack() {Circle().width(${this.cellWidth / 2}px).height(${this.cellWidth / 2}px).fill(Color.Black)Circle().width(${this.cellWidth / 8}px).height(${this.cellWidth / 8}px).fill(Color.White)}}.width(${this.cellWidth}px).height(${this.cellWidth}px).align(Alignment.Top)//大白球 下Stack() {Stack() {Circle().width(${this.cellWidth / 2}px).height(${this.cellWidth / 2}px).fill(Color.White)Circle().width(${this.cellWidth / 8}px).height(${this.cellWidth / 8}px).fill(Color.Black)}}.width(${this.cellWidth}px).height(${this.cellWidth}px).align(Alignment.Bottom)}.width(${this.cellWidth}px).height(${this.cellWidth}px).borderWidth(1).borderColor(Color.Black).borderRadius(50%).backgroundColor(Color.White).clip(true).rotate({angle: this.angle}).onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) {console.info(Test Row isVisible: isVisible , currentRatio: currentRatio)if (isVisible currentRatio 1.0) {console.info(Test Row is fully visible.)this.startAnim()}if (!isVisible currentRatio 0.0) {console.info(Test Row is completely invisible.)this.endAnim()}})}.width(${this.taiChiWidth}px).height(${this.taiChiWidth}px)} }Entry Component struct Page08 {State loadingWidth: number 150State isShowLoading: boolean true;State animationCurve: Curve Curve.Linearbuild() {Column({ space: 20 }) {Text(官方Loading组件)Column() {LoadingProgress().width(this.loadingWidth).visibility(this.isShowLoading ? Visibility.Visible : Visibility.None)}.height(this.loadingWidth).width(this.loadingWidth)Text(自定义太极Loading组件)Column() {TaiChiLoadingProgress({ taiChiWidth: vp2px(this.loadingWidth), animationCurve: this.animationCurve }).visibility(this.isShowLoading ? Visibility.Visible : Visibility.Hidden)}.height(this.loadingWidth).width(this.loadingWidth)Row() {Flex({ wrap: FlexWrap.Wrap }) {Text(显示/隐藏).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.isShowLoading !this.isShowLoading})Text(Linear动画).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.animationCurve Curve.Linear})Text(FastOutLinearIn动画).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.animationCurve Curve.FastOutLinearIn})Text(EaseIn动画).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.animationCurve Curve.EaseIn})Text(EaseOut动画).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.animationCurve Curve.EaseOut})Text(EaseInOut动画).textAlign(TextAlign.Center).width(200lpx).height(200lpx).margin(10lpx).backgroundColor(Color.Black).borderRadius(5).backgroundColor(Color.Orange).fontColor(Color.White).clickEffect({ level: ClickEffectLevel.LIGHT }).onClick(() {this.animationCurve Curve.EaseInOut})}.width(660lpx)}.width(100%).justifyContent(FlexAlign.Center)}.height(100%).width(100%).backgroundColor(#f9feff)} }
http://www.hkea.cn/news/14509775/

相关文章:

  • 门户网站开发项目一个专做里番的网站
  • 企业网站后台管理妇科医院网站建设
  • 模板网站的建设中山做网站
  • 个人网站命名 备案电子商务主要学什么专业课程
  • 换网站了吗河南旅游集团 网站建设
  • 网站建设与维护实验报告五星级酒店网站建设方案
  • 重庆化工建设信息网站金山网站建设费用
  • 百度网站建设如何网站建设好后怎么制作网页
  • 做百度网站费用多少vue 做网站 seo
  • 淮南市城乡建设档案馆网站美食网站建设的意义
  • 棋牌网站开发常熟做网站的公司
  • 免费设计海报的网站Wordpress国际收款
  • 网站建设兆金手指花总网站建设方案选公司
  • 苏州建网站的公司哪家公司好怎么查个人征信记录
  • 网站优化 流量怎么做自己网站的后台
  • wordpress 哪些网站如何做网络营销网站
  • 国外网站加速搜素引擎排名优化计费方式
  • 给网站增加功能怎么做良乡网站建设
  • 网站建设维护管理软件代理网页游戏多少钱
  • 大港天津网站建设查做空运磁检的网站
  • 学做网站php吗wordpress重建缩略图
  • 展示型装饰网站模板下载多城市分站站群cms
  • 黑龙江省建设集团有限公司网站自己做的网站能赚钱吗
  • 浙江众安建设集团有限公司网站长春财经学院是一本还是二本
  • 怎么修改网站首页logo网站优化中友情链接怎么做
  • 什么地方可以做网站wordpress 虚拟商品插件
  • 广州网站建设q.479185700棒wordpress 添加导航栏
  • 北京网站设计公司yy成都柚米科技15wordpress配置mysql
  • 网站建设开发综合实训报告泰安人才网最新招聘网
  • 做外单网站wordpress 动态插件