CSS3存储当前动画值 [英] CSS3 storing current animation values
本文介绍了CSS3存储当前动画值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个div,这样做一个旋转动画:
i have a div that is doing a rotation animation as such :
@-webkit-keyframes animateCamera {
from {-webkit-transform: translateZ(300px) rotateY(0deg);}
to {-webkit-transform: translateZ(300px) rotateY(360deg);}}
}
我想要发生的是,当我触发一个事件(让我们说一个mouseclick),我想存储在变量当前rotateY的动画。例如,如果在动画处于140deg左右时触发了点击事件,我想将140度存储在变量中。有人知道如何返回当前的rotateY值吗?
what I want to happen is that when I trigger an event (let us say a mouseclick), I want to store in a variable the current rotateY as of the animation. For example, if the click event is triggered while the animation is at around 140deg, I want that 140 degrees stored in a variable. Does anybody know how to return the current rotateY value? tnx!
推荐答案
我将像任何其他css值一样注册当前轮值。
I would wager your access the current rotation value like any other css value.
Javascript:
Javascript:
var item = document.getElementById["yourId"];
var currentValueForAttribute = item.style.-attribute here-;
这篇关于CSS3存储当前动画值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文