首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >微信小程序--跃动方块

微信小程序--跃动方块

作者头像
海轰Pro
发布于 2021-04-09 17:16:56
发布于 2021-04-09 17:16:56
9990
举报

效果展示

Demo代码

wxml

代码语言:javascript
复制
<!-- loading.wxml -->
<view class="loading">
  <view class="dot" animation="{{alpha[0]}}"></view>
  <view class="dot" animation="{{alpha[1]}}"></view>
  <view class="dot" animation="{{alpha[2]}}"></view>
  <view class="dot" animation="{{alpha[3]}}"></view>
  <view class="dot" animation="{{alpha[4]}}"></view>
</view>

wxss

代码语言:javascript
复制
page{
 background-size: cover;
 background-color: black;
}

/** loading.wxss **/
.loading {
 width: 100%;
 position: absolute;
 bottom: 50%;
 justify-content: center;
 text-align: center;
}

.loading .dot{
 background-color:orange;
 display: inline-block;
 /**圆点大小在这里设置,高宽一致,圆角值为高宽的一半**/
 width: 48rpx;
 height: 48rpx;
 border-radius: 8rpx;
 margin: 0 10rpx;
 opacity: 0;
}

js

代码语言:javascript
复制
/* loading.js */
Page({
  data: {
    alpha: [1, 1, 1, 1, 1]
 .

效果展示

Demo代码

wxml

代码语言:javascript
复制
<!-- loading.wxml -->
<view class="loading">
  <view class="dot" animation="{{alpha[0]}}"></view>
  <view class="dot" animation="{{alpha[1]}}"></view>
  <view class="dot" animation="{{alpha[2]}}"></view>
  <view class="dot" animation="{{alpha[3]}}"></view>
  <view class="dot" animation="{{alpha[4]}}"></view>
</view>

wxss

代码语言:javascript
复制
page{
 background-size: cover;
 background-color: black;
}

/** loading.wxss **/
.loading {
 width: 100%;
 position: absolute;
 bottom: 50%;
 justify-content: center;
 text-align: center;
}

.loading .dot{
 background-color:white;
 display: inline-block;
 /**圆点大小在这里设置,高宽一致,圆角值为高宽的一半**/
 width: 48rpx;
 height: 48rpx;
 border-radius: 24rpx;
 margin: 0 10rpx;
 opacity: 0;
}

js

代码语言:javascript
复制
/* loading.js */
Page({
  data: {
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021-01-30 ,如有侵权请联系 cloudcommunity@tencent.com 删除
目录
  • 效果展示
  • Demo代码
    • wxml
    • wxss
    • js
  • 效果展示
  • Demo代码
    • wxml
    • wxss
    • js
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档