盒子动画demo

<div class="box-wrapper">
  <div class="box">
    <div class="box-item white"></div>
    <div class="box-item orange"></div>
    <div class="box-item red"></div>
  </div>
</div>
.box-wrapper {
    font-weight: bold;
    display: inline-block;
    margin-top: 10px;
    width: 165px;
    /* Rotate div */
    transform: rotate(-24deg);
    -ms-transform: rotate(-24deg);
    /* Internet Explorer */
    -moz-transform: rotate(-24deg);
    /* Firefox */
    -webkit-transform: rotate(-24deg);
    /* Safari 和 Chrome */
    -o-transform: rotate(-24deg);
    /* Opera */
    transition: 2s;
    -moz-transition: 2s;
    /* Firefox 4 */
    -webkit-transition: 2s;
    /* Safari and Chrome */
    -o-transition: 2s;
    /* Opera */

    transition: All 0.4s ease-in-out;
    -webkit-transition: All 0.4s ease-in-out;
    -moz-transition: All 0.4s ease-in-out;
    -o-transition: All 0.4s ease-in-out;
  }

  .box-wrapper:hover {
    font-size: 30px;
    transform: scale(1.3);
    -webkit-transform: scale(1.3);
    -moz-transform: scale(1.3);
    -o-transform: scale(1.3);
    -ms-transform: scale(1.3);
  }
  .box {
    margin: 0 auto;
    position: relative;
    width: 100px;
    height: 100px;
    box-sizing: border-box;
    background-color: white;
  }
  .box::before,
  .box::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 4px solid transparent;
    animation-timing-function: linear;
  }

  .box::before {
    top: 0;
    left: 0;
    border-top-color: black;
    border-right-color: black;
    animation: border-before 1.5s infinite;
    animation-direction: alternate;
  }

  .box::after {
    bottom: 0;
    right: 0;
    border-bottom-color: black;
    border-left-color: black;
    animation: border-after 1.5s infinite;
    animation-direction: alternate;
  }

  .box .box-item {
    position: absolute;
  }

  .box .red {
    top: 4px;
    bottom: 0;
    left: 0;
    border-right: 4px solid black;
    background-color: #EA5664;
    animation: red 1.5s infinite;
    animation-direction: alternate;
  }

  .box .orange {
    bottom: 0;
    left: 27%;
    right: 4px;
    border-top: 4px solid black;
    background-color: #F3B93F;
    animation: orange 1.5s infinite;
    animation-direction: alternate;
  }

  .box .white {
    right: 5px;
    top: 4px;
    buttom: 50%;
    height: 50%;
    border-left: 4px solid black;
    background-color: #fff;
    animation: white 1.5s infinite;
    animation-direction: alternate;
  }

  @keyframes border-before {
    0% {
      width: 0;
      height: 0;
      border-right-color: transparent;
    }
    5.99% {
      border-right-color: transparent;
    }
    6% {
      height: 0;
      width: 100%;
      border-right-color: black;
    }
    25%,
    100% {
      width: 100%;
      height: 100%;
    }
  }

  @keyframes border-after {
    0%,
    24.99% {
      width: 0;
      height: 0;
      border-left-color: transparent;
      border-bottom-color: transparent;
    }
    25% {
      border-left-color: transparent;
      border-bottom-color: black;
    }
    36.99% {
      border-left-color: transparent;
    }
    37% {
      height: 0;
      width: 100%;
      border-left-color: black;
    }
    50%,
    100% {
      width: 100%;
      height: 100%;
    }
  }

  @keyframes red {
    0%,
    50% {
      width: 0;
      opacity: 0;
    }
    50.01% {
      opacity: 1;
    }
    65%,
    100% {
      width: 27%;
      opacity: 1;
    }
  }

  @keyframes orange {
    0%,
    65% {
      height: 0;
      opacity: 0;
    }
    65.01% {
      opacity: 1;
    }
    80%,
    100% {
      height: 50%;
      opacity: 1;
    }
  }

  @keyframes white {
    0%,
    75% {
      width: 0;
      opacity: 0;
    }

    75.01% {
      opacity: 1;
    }
    90%,
    100% {
      width: 27%;
      opacity: 1;
    }
  }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Lottie动画Demo是一种用于创建和展示矢量动画的工具。通过使用Lottie库,我们可以将由设计师在Adobe After Effects中创建的动画文件(如JSON文件)直接导出到移动应用程序中,并在应用中实现动画效果。 Lottie动画Demo具有以下优点和特点: 1. 高效性:Lottie动画使用矢量图形格式,因此文件体积较小,加载速度快。这使得应用程序能够在各种设备上平滑运行,并节省了用户的流量和存储空间。 2. 动画效果多样性:设计师可以在After Effects中自由制作各种复杂的动画效果,并通过Lottie库导出为可重用的JSON文件。这些动画可以应用于按钮、图标、背景等各种元素,使应用程序更具吸引力和互动性。 3. 可定制性:Lottie动画Demo不仅能够播放设计师创建的静态动画,还可以根据应用程序需求进行动态修改和操作。开发者可以使用Lottie库中提供的方法,通过代码控制动画的播放速度、循环次数、暂停和继续等等。 4. 跨平台兼容性:Lottie动画Demo可在iOS、Android和Web等多个平台上使用。这使得开发者能够创建一次动画,并在不同的操作系统和设备上无需进行额外的开发工作即可实现相同的动画效果。 总结而言,Lottie动画Demo是一项强大的工具,可以让应用程序中的设计更加丰富和生动。它不仅让设计师能够创建复杂的动画效果,还提供了开发者所需的灵活性和可定制性。有了Lottie动画Demo,我们可以为应用程序带来更出色的用户体验,提升用户对应用程序的满意度和忠诚度。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值