WebKit 规模转换问题
我需要有关 webkit 规模功能的帮助。
我有一个 .css 文件,其属性如下所示:
@-webkit-keyframes expand
{
from {-webkit-transform:scale(1)}
to {-webkit-transform:scale(1.2)}
}
.image-highlight
{
-webkit-animation-name: expand;
-webkit-animation-duration:0.2s;
-webkit-animation-iteration-count:1;
-webkit-animation-timing-function:ease;
}
我有一个带有元素的 html:
<div id="slider">
<img src="images/blueMarble_0.PNG" />
<img src="images/blueMarble_1.PNG" />
<img src="images/blueMarble_2.PNG" />
<img src="images/blueMarble_3.PNG" />
<img src="images/blueMarble_4.PNG" />
</div>
我有一个 js 文件,其中包含一个函数,该函数将对数组的中间图像进行动画处理(缩放)。 我正在使用这个 jQuery 语句来制作动画:
`$(pic[2]).addClass('image-highlight');`
这个 jquery 实际上缩放了图像 (pic[2])。但缩放会持续 0.2 秒,然后缩小到原始大小。即使完成 0.2 秒后如何保持缩放比例?我不想将其调整为原始大小。可以在不改变动画持续时间的情况下完成吗? 请你帮我解决这个问题吗?
I need help on webkit scale functionality.
I have a .css file with properties as shown :
@-webkit-keyframes expand
{
from {-webkit-transform:scale(1)}
to {-webkit-transform:scale(1.2)}
}
.image-highlight
{
-webkit-animation-name: expand;
-webkit-animation-duration:0.2s;
-webkit-animation-iteration-count:1;
-webkit-animation-timing-function:ease;
}
I have a html with elements :
<div id="slider">
<img src="images/blueMarble_0.PNG" />
<img src="images/blueMarble_1.PNG" />
<img src="images/blueMarble_2.PNG" />
<img src="images/blueMarble_3.PNG" />
<img src="images/blueMarble_4.PNG" />
</div>
I have a js file with a function which will animate(scale) the middle image of the array.
and I am using this jQuery statement to do the animation:
`$(pic[2]).addClass('image-highlight');`
This jquery actually scales the image (pic[2]). But scaling happens for 0.2 secs and it scales down to original size. How can I retain the scaling even after completion of 0.2 secs? I don't want to resize it to original size. Can it be done without changing the animation duration?
Please can you help me on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您想添加到您的类中:
-webkit-animation-fill-mode: Both
这将导致动画的初始关键帧在您的
image-highlight
时立即显示应用类并且最终关键帧将在动画完成后继续显示。您可以使用的其他值:
-webkit-animation-fill-mode:forwards
可能也能满足您的需求。I believe you want to add to your class:
-webkit-animation-fill-mode: both
This will cause the animation's initial keyframe to be shown immediately when your
image-highlight
class is applied and the final keyframe will continue to be shown after the animation finishes.Other values you can use:
-webkit-animation-fill-mode: forwards
will probably also meet your needs.