發覺前一個項目需求很好玩的兩個CSS animation

來源:互聯網
上載者:User

首先js在這裡:

  function addAnimation(argument) {            $('.plane-outer').addClass('plane-outer-animation');            $('.plane').addClass('plane-animation');            $('.text').addClass('text-animation');        }        function removeAnimation(argument) {            $('.plane-outer').removeClass('plane-outer-animation');            $('.plane').removeClass('plane-animation');            $('.text').removeClass('text-animation');        }        addAnimation();



然後用定時來去掉動畫:

  var num = 0;        function timing() {            num++;            if (num % 11 == 0) {                removeAnimation();            } else if (num % 11 == 2) {                addAnimation();            }        }        setInterval("timing()", 1000);


給兩個div上動畫css和結束時候去掉動畫,css3樣式如下:

.index .plane-outer-animation {  -webkit-animation: forward 6s 1 linear;          animation: forward 6s 1 linear;}.index .plane-animation {  -webkit-animation: down 6s 1 ease-in;          animation: down 6s 1 ease-in;}.index .text-animation {  -webkit-animation: dashin 1s 5s 1 ease-in, wobble 2s 5s 2, dashout 5s 6s 1;          animation: dashin 1s 5s 1 ease-in, wobble 2s 5s 2, dashout 5s 6s 1;}


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.