小程序制作小程序启动开屏动画,让你的小程序炫酷起来!


请添加图片描述

CSS与页面

WXML代码

<view wx:if="{{showTransition}}" bind:tap="infoPage" class="card">
</view>
  • 变量showTransition:控制是显示动画还是显示首页内容
  • infoPage:手动关闭动画方法
  • card:样式

WXSS代码

.card {
  position: relative;
  width: 100%;
  height: 100vh;
  /* 可以改变背景颜色 */
  background: linear-gradient(120deg, #e99361 0%, #63c4f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: bold;
  border-radius: 15px;
  cursor: pointer;
}
.card::before, .card::after {
  position: absolute;
  content: "";
  width: 20%;
  height: 20%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  font-weight: bold;
  background-color: #fff;
  transition: all 2s;
}
.card::before {
  top: 0;
  right: 0;
  border-radius: 0 15px 0 100%;
}
.card::after {
  bottom: 0;
  left: 0;
  border-radius: 0 100% 0 15px;
}
.card::before, .card::after {
  width: 100%;
  height: 100%;
  border-radius: 15px;
  animation: expand 2s;
}
@keyframes expand {
  0% {
    width: 10%;
    height: 10%;
    border-radius: 15px;
  }
  100% {
    width: 100%;
    height: 100%;
    border-radius: 15px;
  }
}
.card:after {
  content: "韩博士";
}

JS代码

data: {
 // 启动动画控制
 showTransition: true
},

onLoad(options) {
  setTimeout(() => {
    this.infoPage();
  }, 3000); // 调整动画执行的时间
},
 
/**
 * 跳过引导
 */
infoPage() {
  this.setData({
    showTransition: false
  })
},

😁 作者:Teddy (公众号:码尚云软件)
ok!到这里就大功告成,小编(Teddy)在这里先感谢大家的到来。
虽然不是太详细,小编已经很努力,给小编来个一键三连(点赞,关注,收藏),小编会越来越努力。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小码农吗

感谢您的大力支持,感谢感谢!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值