赵晓红 發表於 2020-8-26 11:49:00

CSS 动画学习笔记——Animation篇

<p>首先了解一下 <strong>Animation&nbsp;</strong>的基本用法,使用其需要给动画指定一个周期持续的时间,以及动画效果的名称。可以看一下demo</p>
<p style="text-align: center"><img src="https://img2020.cnblogs.com/blog/1024013/202008/1024013-20200826102554403-1835736802.gif"></p>
<p>&nbsp;</p>
<p style="text-align: center"><span style="color: rgba(192, 192, 192, 1)">注释:这是一个给透明和背景色属性设置的一个动画过渡效果</span></p>
<p style="text-align: left">实现很简单(具体看到代码中的注释):</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)"> 1</span> <span style="color: rgba(128, 0, 0, 1)">      .block_wrap </span>{
<span style="color: rgba(0, 128, 128, 1)"> 2</span> <span style="color: rgba(255, 0, 0, 1)">            width</span>:<span style="color: rgba(0, 0, 255, 1)"> 500px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 3</span> <span style="color: rgba(255, 0, 0, 1)">            height</span>:<span style="color: rgba(0, 0, 255, 1)"> 500px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 4</span> <span style="color: rgba(255, 0, 0, 1)">            background</span>:<span style="color: rgba(0, 0, 255, 1)"> #e3e3e3</span>;
<span style="color: rgba(0, 128, 128, 1)"> 5</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">第一个参数为这个动画的持续时间,第二个参数是动画效果的标题,可以理解为定义一个class,不过这是专属于动画的class</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 6</span> <span style="color: rgba(255, 0, 0, 1)">            animation</span>:<span style="color: rgba(0, 0, 255, 1)"> 4s opacity</span>;
<span style="color: rgba(0, 128, 128, 1)"> 7</span> <span style="color: rgba(255, 0, 0, 1)">            margin</span>:<span style="color: rgba(0, 0, 255, 1)"> 0 auto</span>;
<span style="color: rgba(0, 128, 128, 1)"> 8</span>         }
<span style="color: rgba(0, 128, 128, 1)"> 9</span>         <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画效果,opacity为效果标题,@keyframes必须要写</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">10</span> <span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{
<span style="color: rgba(0, 128, 128, 1)">11</span> <span style="color: rgba(255, 0, 0, 1)">            0% {opacity</span>:<span style="color: rgba(0, 0, 255, 1)"> 0</span>;<span style="color: rgba(255, 0, 0, 1)"> background</span>: }
<span style="color: rgba(0, 128, 128, 1)">12</span> <span style="color: rgba(128, 0, 0, 1)">            25% </span>{<span style="color: rgba(255, 0, 0, 1)">opacity</span>:<span style="color: rgba(0, 0, 255, 1)"> 0.25</span>}
<span style="color: rgba(0, 128, 128, 1)">13</span> <span style="color: rgba(128, 0, 0, 1)">            50% </span>{<span style="color: rgba(255, 0, 0, 1)">opacity</span>:<span style="color: rgba(0, 0, 255, 1)"> 0.5</span>}
<span style="color: rgba(0, 128, 128, 1)">14</span> <span style="color: rgba(128, 0, 0, 1)">            100% </span>{<span style="color: rgba(255, 0, 0, 1)">opacity</span>:<span style="color: rgba(0, 0, 255, 1)"> 1</span>;<span style="color: rgba(255, 0, 0, 1)"> background</span>:<span style="color: rgba(0, 0, 255, 1)"> red</span>}
<span style="color: rgba(0, 128, 128, 1)">15</span> <span style="color: rgba(128, 0, 0, 1)">      }</span></pre>
</div>
<p><strong>除了代码中的注释,另外还需要说一下,opacity 中,从 0%—100%,这是我们给动画指定的一个持续周期,指定了到哪个程度,动画就按照里面的属性进行展示,这个周期是必须的!&nbsp;</strong></p>
<p>上面是一个很简单的动画,刷新一次页面即展示一次,如果想要重复地展示动画效果呢?简单,只需要添加一个&nbsp;<span style="font-size: 16px"><strong>infinite</strong></span> 关键字 ,<strong>可以指定循环次数,将 infinite 关键字换成数字即可</strong>。</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)">1</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">添加infinite关键字,使其可重复</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">2</span> <span style="color: rgba(128, 0, 0, 1)">            animation: 4s opacity infinite;</span></pre>
</div>
<p>&nbsp;</p>
<p style="text-align: center"><img src="https://img2020.cnblogs.com/blog/1024013/202008/1024013-20200826103616587-180854209.gif"></p>
<p>&nbsp;</p>
<p style="text-align: center"><span style="color: rgba(192, 192, 192, 1)">注释:这是一个重复展示的动画效果</span></p>
<p style="text-align: left">动画默认在展示完后回到初始状态,有时想让动画定格在最后状态,可以使用 <strong>animation-fill-mode</strong> 属性,该属性有三个值</p>
<ul>
<li style="text-align: left"><strong>none:默认值,动画展示完后回到初始状态</strong></li>
<li style="text-align: left"><strong>backwards:动画回到第一帧的状态</strong></li>
<li style="text-align: left"><strong>forwards:动画定格在最后状态</strong></li>
<li style="text-align: left"><strong>both:根据animation-direction 轮流应用forwards和backwards规则</strong></li>
</ul>
<p style="text-align: left">使用:</p>
<div class="cnblogs_code">
<pre>            <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">直接在后面添加即可</span><span style="color: rgba(0, 128, 0, 1)">*/</span><span style="color: rgba(128, 0, 0, 1)">
            animation: 1s opacity forwards;</span></pre>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>下面看一下backwards的效果:</p>
<p style="text-align: center">&nbsp;<img src="https://img2020.cnblogs.com/blog/1024013/202008/1024013-20200826111849583-1916027529.gif"></p>
<p>&nbsp;</p>
<p style="text-align: center"><span style="background-color: rgba(255, 255, 255, 1); color: rgba(192, 192, 192, 1)">注释:backwards的效果,简单动画时,和none差不多</span></p>
<p style="text-align: left"><span style="color: rgba(0, 0, 0, 1)">在上面写demo尝试以上属性时,发现动画循环播放时,其实都是从初始状态开始,那么如果不想这样子呢?有另一个属性 <strong>animation-direction&nbsp;</strong>可以定义它的播放,<strong>direction&nbsp;</strong>有以下值:</span></p>
<ul>
<li style="text-align: left"><strong><span style="color: rgba(0, 0, 0, 1)">normal:默认值,对动画播放无状态影响</span></strong></li>
<li style="text-align: left"><strong><span style="color: rgba(0, 0, 0, 1)">alternate:改变其播放方向,先是按照正常播放,接着反方向播放,以此循环</span></strong></li>
<li style="text-align: left"><strong><span style="color: rgba(0, 0, 0, 1)">reverse:动画按照反方向播放</span></strong></li>
<li style="text-align: left"><strong><span style="color: rgba(0, 0, 0, 1)">alternate-reverse:先是反方向播放,接着正方向播放,以此循环</span></strong></li>
</ul>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)"> 1</span> <span style="color: rgba(128, 0, 0, 1)">      .block_wrap </span>{
<span style="color: rgba(0, 128, 128, 1)"> 2</span> <span style="color: rgba(255, 0, 0, 1)">            width</span>:<span style="color: rgba(0, 0, 255, 1)"> 500px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 3</span> <span style="color: rgba(255, 0, 0, 1)">            height</span>:<span style="color: rgba(0, 0, 255, 1)"> 500px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 4</span> <span style="color: rgba(255, 0, 0, 1)">            background</span>:<span style="color: rgba(0, 0, 255, 1)"> #e3e3e3</span>;
<span style="color: rgba(0, 128, 128, 1)"> 5</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">添加infinite关键字,使其可重复,接着更换每个不同值看效果</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 6</span> <span style="color: rgba(255, 0, 0, 1)">            animation</span>:<span style="color: rgba(0, 0, 255, 1)"> 1s opacity infinite alternate-reverse</span>;
<span style="color: rgba(0, 128, 128, 1)"> 7</span> <span style="color: rgba(255, 0, 0, 1)">            margin</span>:<span style="color: rgba(0, 0, 255, 1)"> 0 auto</span>;
<span style="color: rgba(0, 128, 128, 1)"> 8</span>         }
<span style="color: rgba(0, 128, 128, 1)"> 9</span>         <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画效果,opacity为效果标题,@keyframes必须要写</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">10</span> <span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{
<span style="color: rgba(0, 128, 128, 1)">11</span> <span style="color: rgba(255, 0, 0, 1)">            to {
</span><span style="color: rgba(0, 128, 128, 1)">12</span> <span style="color: rgba(255, 0, 0, 1)">                transform</span>:<span style="color: rgba(0, 0, 255, 1)"> rotate(360deg)</span>;
<span style="color: rgba(0, 128, 128, 1)">13</span>             }
<span style="color: rgba(0, 128, 128, 1)">14</span> <span style="color: rgba(128, 0, 0, 1)">      }</span></pre>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>&nbsp;可以使用上面这段代码,更换每个值看一下效果。</strong></p>
<p>我们在上一篇,transition的学习中有提到,transition是有简写形式的,也可以分开来写。同理,animation也是可以这样的,全部的属性简写如下:</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)">1</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">第一个为动画持续时间,第二个为动画延迟(delay)时间,第三个为动画效果标题,第四个为动画状态变化速度,第五个为循环次数,第五个为动画状态设置,第六个为动画播放方向</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">2</span> <span style="color: rgba(128, 0, 0, 1)">            animation: 1s 1s opacity linear infinite forwards normal;</span></pre>
</div>
<p>&nbsp;</p>
<p>分开写也是可以的</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)"> 1</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画标题</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 2</span> <span style="color: rgba(128, 0, 0, 1)">            animation-name: opacity;
</span><span style="color: rgba(0, 128, 128, 1)"> 3</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画持续时间</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 4</span> <span style="color: rgba(128, 0, 0, 1)">            animation-duration: 1s;
</span><span style="color: rgba(0, 128, 128, 1)"> 5</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画状态变化速度</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 6</span> <span style="color: rgba(128, 0, 0, 1)">            animation-timing-function: linear;
</span><span style="color: rgba(0, 128, 128, 1)"> 7</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画延迟(delay)时间</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 8</span> <span style="color: rgba(128, 0, 0, 1)">            animation-delay: 1s;
</span><span style="color: rgba(0, 128, 128, 1)"> 9</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画状态设置</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">10</span> <span style="color: rgba(128, 0, 0, 1)">            animation-fill-mode:forwards;
</span><span style="color: rgba(0, 128, 128, 1)">11</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画播放方向</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">12</span> <span style="color: rgba(128, 0, 0, 1)">            animation-direction: normal;
</span><span style="color: rgba(0, 128, 128, 1)">13</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">循环次数</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">14</span> <span style="color: rgba(128, 0, 0, 1)">            animation-iteration-count: infinite;<br></span></pre>
</div>
<p>&nbsp;在了解animation的过程中,发现在使用animation时,往往配合着 <span style="font-size: 16px"><strong>@keyframes</strong></span>,个人理解为,它是一个专属于动画的class,它用来定义动画的各个状态,下来了解一下它的写法,上述所用到的写法</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)">1</span> <span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{
<span style="color: rgba(0, 128, 128, 1)">2</span> <span style="color: rgba(255, 0, 0, 1)">            to {
</span><span style="color: rgba(0, 128, 128, 1)">3</span> <span style="color: rgba(255, 0, 0, 1)">                transform</span>:<span style="color: rgba(0, 0, 255, 1)"> rotate(145deg)</span>;
<span style="color: rgba(0, 128, 128, 1)">4</span>             }
<span style="color: rgba(0, 128, 128, 1)">5</span> <span style="color: rgba(128, 0, 0, 1)">      }</span></pre>
</div>
<p>&nbsp;</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)">1</span> <span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{
<span style="color: rgba(0, 128, 128, 1)">2</span> <span style="color: rgba(255, 0, 0, 1)">            0% {background</span>:<span style="color: rgba(0, 0, 255, 1)"> red</span>}
<span style="color: rgba(0, 128, 128, 1)">3</span> <span style="color: rgba(128, 0, 0, 1)">            25% </span>{<span style="color: rgba(255, 0, 0, 1)">background</span>:<span style="color: rgba(0, 0, 255, 1)"> orange</span>}
<span style="color: rgba(0, 128, 128, 1)">4</span> <span style="color: rgba(128, 0, 0, 1)">            50% </span>{<span style="color: rgba(255, 0, 0, 1)">background</span>:<span style="color: rgba(0, 0, 255, 1)"> pink</span>}
<span style="color: rgba(0, 128, 128, 1)">5</span> <span style="color: rgba(128, 0, 0, 1)">            100% </span>{<span style="color: rgba(255, 0, 0, 1)">background</span>:<span style="color: rgba(0, 0, 255, 1)"> black</span>}      
<span style="color: rgba(0, 128, 128, 1)">6</span> <span style="color: rgba(128, 0, 0, 1)">      }</span></pre>
</div>
<p>&nbsp;</p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{<span style="color: rgba(255, 0, 0, 1)">
            from,to { transform</span>:<span style="color: rgba(0, 0, 255, 1)"> rotate3d(1,1,1,360deg)</span>; }<span style="color: rgba(128, 0, 0, 1)">
            50% </span>{<span style="color: rgba(255, 0, 0, 1)"> transform</span>:<span style="color: rgba(0, 0, 255, 1)"> scale(1.2)</span>; }<span style="color: rgba(128, 0, 0, 1)">   
      }</span></pre>
</div>
<p>&nbsp;</p>
<p>另外,需要注意的是,<span style="font-size: 16px"><strong>from</strong> <span style="background-color: rgba(255, 255, 255, 1)"><strong>to</strong><span style="font-size: 14px">,它们其实就是 0%-100%的缩写</span></span></span></p>
<p>&nbsp;</p>
<p><span style="font-size: 16px"><span style="background-color: rgba(255, 255, 255, 1)"><span style="font-size: 14px">到了这里,上面的基本上能满足大部分我们项目中的需求了。但是,animation还有一个很好玩的属性——<span style="font-size: 16px"><strong>animation-play-state</strong><span style="font-size: 14px">,但从字面意思上来看,很明显就是动画的播放状态。没错,它就是用来控制动画的播放状态。</span></span></span></span></span></p>
<p><span style="font-size: 16px"><span style="background-color: rgba(255, 255, 255, 1)"><span style="font-size: 14px"><span style="font-size: 16px"><span style="font-size: 14px">它有两个值</span></span></span></span></span></p>
<ul>
<li><strong><span style="font-size: 16px"><span style="background-color: rgba(255, 255, 255, 1)"><span style="font-size: 14px"><span style="font-size: 16px"><span style="font-size: 14px">pause:暂停</span></span></span></span></span></strong></li>
<li><strong><span style="font-size: 16px"><span style="background-color: rgba(255, 255, 255, 1)"><span style="font-size: 14px"><span style="font-size: 16px"><span style="font-size: 14px">running:播放</span></span></span></span></span></strong></li>
</ul>
<p>这是一个很有意思的属性,如若编写一个很复杂的动画,并且动画持续时间特长,配合上这个属性,我们相当于用CSS制作一个小动画片。看一下这个属性的效果:</p>
<p style="text-align: center"><img src="https://img2020.cnblogs.com/blog/1024013/202008/1024013-20200826134958045-1326873302.gif"></p>
<p>&nbsp;</p>
<p style="text-align: center"><span style="color: rgba(192, 192, 192, 1)">注释:有了控制播放状态的动画</span></p>
<p style="text-align: left"><span style="color: rgba(0, 0, 0, 1)">上面的demo看起来很像是<strong>卡顿</strong>了,其实并不是,只是用hover来控制了动画的播放状态,所以说这是个很有意思的属性。这一段的代码如下:</span></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(0, 128, 128, 1)"> 1</span> <span style="color: rgba(128, 0, 0, 1)">      .block_wrap </span>{
<span style="color: rgba(0, 128, 128, 1)"> 2</span> <span style="color: rgba(255, 0, 0, 1)">            width</span>:<span style="color: rgba(0, 0, 255, 1)"> 300px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 3</span> <span style="color: rgba(255, 0, 0, 1)">            height</span>:<span style="color: rgba(0, 0, 255, 1)"> 300px</span>;
<span style="color: rgba(0, 128, 128, 1)"> 4</span> <span style="color: rgba(255, 0, 0, 1)">            background</span>:<span style="color: rgba(0, 0, 255, 1)"> #e3e3e3</span>;
<span style="color: rgba(0, 128, 128, 1)"> 5</span> <span style="color: rgba(255, 0, 0, 1)">            animation</span>:<span style="color: rgba(0, 0, 255, 1)"> 1s opacity linear infinite forwards normal</span>;
<span style="color: rgba(0, 128, 128, 1)"> 6</span>             <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画原本的状态是暂停的</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)"> 7</span> <span style="color: rgba(255, 0, 0, 1)">            animation-play-state</span>:<span style="color: rgba(0, 0, 255, 1)"> paused</span>;
<span style="color: rgba(0, 128, 128, 1)"> 8</span> <span style="color: rgba(255, 0, 0, 1)">            margin</span>:<span style="color: rgba(0, 0, 255, 1)"> 0 auto</span>;
<span style="color: rgba(0, 128, 128, 1)"> 9</span>         }
<span style="color: rgba(0, 128, 128, 1)">10</span>         <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">动画效果,opacity为效果标题,@keyframes必须要写</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">11</span> <span style="color: rgba(128, 0, 0, 1)">      @keyframes opacity </span>{
<span style="color: rgba(0, 128, 128, 1)">12</span> <span style="color: rgba(255, 0, 0, 1)">            from,to { transform</span>:<span style="color: rgba(0, 0, 255, 1)"> rotate3d(1,1,1,180deg)</span>; }
<span style="color: rgba(0, 128, 128, 1)">13</span> <span style="color: rgba(128, 0, 0, 1)">            50% </span>{<span style="color: rgba(255, 0, 0, 1)"> transform</span>:<span style="color: rgba(0, 0, 255, 1)"> rotate(45deg)</span>;}   
<span style="color: rgba(0, 128, 128, 1)">14</span> <span style="color: rgba(128, 0, 0, 1)">      }
</span><span style="color: rgba(0, 128, 128, 1)">15</span>         <span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)">当鼠标放上来时,动画才会进行</span><span style="color: rgba(0, 128, 0, 1)">*/</span>
<span style="color: rgba(0, 128, 128, 1)">16</span> <span style="color: rgba(128, 0, 0, 1)">      .block_wrap:hover </span>{
<span style="color: rgba(0, 128, 128, 1)">17</span> <span style="color: rgba(255, 0, 0, 1)">            animation-play-state</span>:<span style="color: rgba(0, 0, 255, 1)"> running</span>;
<span style="color: rgba(0, 128, 128, 1)">18</span>         }</pre>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>以上就是关于CSS Animation的内容了,相信这篇文章的内容能够满足到大部分的动画需求了。</p>
<p><strong>另外,使用的时候,需要注意一些东西,那就是浏览器的兼容问题。有些浏览器并不能够很好兼容,所以在使用时,写法上要是这样的</strong></p>
<div class="cnblogs_code">
<pre><span style="color: rgba(128, 0, 0, 1)">-ms-animation @-ms-keyframes   </span><span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)"> IE 9 </span><span style="color: rgba(0, 128, 0, 1)">*/</span><span style="color: rgba(128, 0, 0, 1)">
-moz-   </span><span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)"> Firefox </span><span style="color: rgba(0, 128, 0, 1)">*/</span><span style="color: rgba(128, 0, 0, 1)">
-webkit- </span><span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)"> Safari 和 Chrome </span><span style="color: rgba(0, 128, 0, 1)">*/</span><span style="color: rgba(128, 0, 0, 1)">
-o-   </span><span style="color: rgba(0, 128, 0, 1)">/*</span><span style="color: rgba(0, 128, 0, 1)"> Opera </span><span style="color: rgba(0, 128, 0, 1)">*/</span></pre>
</div>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/zhichong/p/13564228.html
頁: [1]
查看完整版本: CSS 动画学习笔记——Animation篇