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

重庆 网站定制wordpress网站模板

重庆 网站定制,wordpress网站模板,便宜网站建设哪家好,seo和sem的联系【引言】#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.dnsts.com.cn/news/151652.html

相关文章:

  • 能看建设动漫黄图的网站网络服务器主要有
  • 做网站的方案小学网站建设报告
  • 微商城网站建设讯息o2o平台都有哪些
  • 阜阳网站建设专业机构辉县网站建设
  • 做网站系统的销售怎么做搭建商城网站
  • 民治做网站哪家便宜wordpress 水墨
  • 东莞网站(建设信科网络)discuz论坛建站教程
  • 如何做简单视频网站广州旅游网络营销
  • 专业的网站制作中心可以建设网站的软件
  • 外贸建站用的服务器公众号开发者密码多长时间生效
  • 中国网站建设市场排名网站建设和管理经验
  • 国内做的比较大的外贸电商网站广西壮族自治区官方网
  • 淮南网站制作公司百度指数快刷软件
  • 青岛黄岛网站建设哪里有平面设计
  • 做试管婴儿的网站南京市的网站是由那几家公司做的
  • 搜狗首页排名优化seo诊断分析在线工具
  • 高端网站建设方案模板范文网线制作线序
  • 怎么让人理解网站建设pc网站运营
  • 网站未在腾讯云备案wordpress模板获取数据
  • 做网站需要申请商标哪些类目中文com域名注册
  • 租网站服务器一个月多少钱邯郸旅游
  • 手机购物网站建设如何网站建设目标
  • 如何创建网站建设网站可以赚钱吗
  • 专业做中文网站wordpress爆破密码字典
  • 网站统计工具是什么意思qq空间认证的网站后台根目录
  • vps建设网站中国石油建设工程协会网站
  • 印尼建设银行网站贵阳酒店网站建设
  • wordpress建站事项网站怎么提升流量
  • ftp如何导入wordpress 主题手机优化器
  • 国外网站建设什么价格低男科医院和正规医院哪家好