8

使用 css3 动画比例、不透明度和其他东西有一些问题,但似乎无法让比例正常工作。

片段:

    #treeLeaves {
        background: url(https://i.pinimg.com/originals/72/c0/8e/72c08eefa235ae1c8aa72caa71eeba39.jpg);
        background-repeat:no-repeat;
        width:100%;
        height:375px;
        z-index:5;
        position:absolute;
        bottom:140px;
        left:0px;
    }

    @keyframe leaves {
        0% {
            transform: scale(1.0);
            -webkit-transform: scale(1.0);
        }
        100% {
            transform: scale(2.0);
            -webkit-transform: scale(2.0);
        }
    }

    #treeLeaves {
        animation: leaves 5s ease-in-out infinite alternate;
        -webkit-animation: leaves 5s ease-in-out infinite alternate;
    }
<div id="treeLeaves"></div>
<div class="leaves">

基本上它的 1 img 我想随着时间的推移不断扩大和缩小。只使用 webkit,因为它只需要在 chrome 中工作。

谢谢。

4

2 回答 2

14

我想你忘记了关键帧中的“s”。试试@keyframes 和@-webkit-keyframes。

于 2014-04-14T20:51:33.357 回答
9

您只是错过skeyframes关键字。

@keyframes leaves {
    0% {
        transform: scale(1.0);
    }
    100% {
        transform: scale(2.0);
    }
}

工作演示

于 2015-12-11T14:50:35.210 回答