简体   繁体   English

CSS3 缩放动画关键帧

[英]CSS3 Scale Animation Keyframes

having a few issues using css3 animation scale, opacity and other things work but cant seem to get scale to work.在使用 css3 动画比例、不透明度和其他东西时遇到一些问题,但似乎无法按比例工作。

snippet:片段:

 #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">

basically its 1 img that i wanted to scale up and down constantly over time.基本上它的 1 个 img,我想随着时间的推移不断放大和缩小。 only using webkit because it only needs to work in chrome.只使用 webkit,因为它只需要在 chrome 中工作。

thanks.谢谢。

I think you forgot the 's' in keyframes.我想你忘记了关键帧中的“s”。 try @keyframes and @-webkit-keyframes.试试@keyframes 和@-webkit-keyframes。

You just missed s in keyframes keyword.您只是在keyframes关键字中错过了s

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

Working demo工作演示

having a few issues using css3 animation scale, opacity and other things work but cant seem to get scale to work.使用css3动画缩放,一些不透明性和其他功能时遇到一些问题,但似乎无法缩放。

snippet:片段:

 #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">

basically its 1 img that i wanted to scale up and down constantly over time.基本上是我想要随着时间的推移不断扩大和缩小的1 img。 only using webkit because it only needs to work in chrome.仅使用webkit,因为它仅需要在chrome中工作。

thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM