欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

微信小程序动画

程序员文章站 2022-05-05 19:09:55
...

 

提升用户体验,擅用微信小程序动画

 

1.css方式使用

 

.content{
  width: 100%;
  height: 100%;
  display: flex;
  flex: 1;
  /* align-items: stretch; */
  justify-content: center;
  /* padding-bottom: 450rpx; */
  
  background: -webkit-gradient(linear, left top, left bottom, from(rgba(244,244,244,0)), color-stop(0.1, #f4f4f4), to(#f4f4f4));
  /* background: linear-gradient(0deg,#fff 70%,rgba(255,255,255,0)); */
  transform: translate3d(0,100%,0);
  animation: rise 3s cubic-bezier(0.19, 1, 0.22, 1) .25s forwards;
  opacity: 0;
}
@keyframes rise{
  0% {opacity: 0;transform: translate3d(0,100%,0);}
  50% {opacity: 1;}
  100% {opacity: 1;transform: translate3d(0,450rpx,0);}
}

.title{
  position: absolute;
  top: 30rpx;
  left: 50%;
  width: 600rpx;
  height: 200rpx;
  margin-left: -300rpx;
  opacity: 0;
  animation: show 2.5s cubic-bezier(0.19, 1, 0.22, 1) .5s forwards;
}
@keyframes show{
  0% {opacity: 0;}
  100% {opacity: .95;}
}

参考