基础动画使用

场景一:一张图片先移动至某个地方,等到触发某个开关后每两秒执行一帧上下动画

1.某一盒子样式
.popup {
transform: translateY(100px); // 页面初次加载只执行一次的动画,纵向移动100px
transition: transform .5s ease-in; //只执行一次的动画时长和速度
animation: tarminalMove 2s infinite; // 分别对应动画名,总时长,运动状态
}
2.添加动画
@keyframes tarminalMove {
from {
transform: translateY(100px);
}

to {
transform: translateY(50px);
}
}

场景二:头部文字循环滚动

1,标签代码样式

<View className="box">
            <View className="animate">
              如果充电中插拔插座可能会导致断电,请重新扫码进行连接
            </View>
          </View>

2.滚动文字的盒子样式

.box {
      width: 100%;
      height: 60px;
      line-height: 60px;
      // margin: 0 auto;
      overflow: hidden;
      background: rgba(255, 247, 204, 1);
    }
    
.animate {
      padding-left: 20px;
      font-size: 28px;
      color: rgba(254, 106, 5, 1);
      display: inline-block;
      white-space: nowrap;
      animation: 5s wordsLoop linear infinite normal;
    }

2.动画

@keyframes wordsLoop {
      0% {
        transform: translateX(100%);
        -webkit-transform: translateX(100%);
      }

      100% {
        transform: translateX(-100%);
        -webkit-transform: translateX(-100%);
      }
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值