【发布时间】:2012-12-14 04:02:41
【问题描述】:
我有一个元素具有 css3 动画并应用了关键帧,但我仍然想缩放这个元素。但似乎因为 transform translate 已经在动画中应用了 transform scale 不起作用
例如:假设我有 4 个云(div 元素)从右到左移动,我希望这些云具有不同的比例
.x1 {
-webkit-animation-name: moveclouds;
-moz-animation-name: moveclouds;
animation-name: moveclouds;
-webkit-animation-duration: 170s;
-moz-animation-duration: 170s;
animation-duration: 170s;
-webkit-animation-timing-function: linear;
-moz-animation-timing-function: linear;
animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-transform: scale(0.79);
-moz-transform: scale(0.79);
-ms-transform: scale(0.79);
-o-transform: scale(0.79);
transform: scale(0.79);
}
.x2{ ...}
.x3{...}
.x4{...}
@keyframes moveclouds {
from {
transform: translateX(2400px);
/* note: I'm using vendor prefixes, I just want to simplified it here */
}
to {
transform: translateX(-200px);
}
}
动画效果很好,但不能缩放
问题:有人知道如何执行规模吗?
我正在使用这个示例 http://thecodeplayer.com/walkthrough/pure-css3-animated-clouds-background,但稍微调整了一下(查看关键帧差异)
【问题讨论】:
-
我什至尝试将“比例”部分移动到不同的类 .y1 或 id #y1 仍然无法工作
标签: css animation transform css-animations