使用javascript在css3中获取@keyframe当前值
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了使用javascript在css3中获取@keyframe当前值,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2115字,纯文字阅读大概需要4分钟。
内容图文
![使用javascript在css3中获取@keyframe当前值](/upload/InfoBanner/zyjiaocheng/749/0f7c51b4552b4f0d85b4ce0e9df1f110.jpg)
在这里看演示:
http://jsfiddle.net/hamidrezabstn/fgcPa/5/
当我点击中间的雨滴时,我希望它旋转到旋转圆圈的当前位置!我尝试下面的JS代码,但它不起作用!我要做的下一件事是用旋转圆圈旋转雨滴!
$(function() {
$('#center').click(function() {
var pos = $('#circle').css('transform')
$(this).css('transform', 'pos')
});
});
解决方法:
编辑:我说在动画中获取转换的当前状态是不可能的,但我错了.对于那个很抱歉 !
要做任何你想做的事,你不需要真正得到它;只是使用它.
我稍微改变了你的HTML,把雨滴放在旋转的div中.
然后,用这个CSS:
.raindrop {
background:center blue;
width:50px;
height:50px;
border-radius: 100%;
border-top-left-radius: 0;
position: absolute;
margin: auto;
left: 75px;
top: 75px;
animation: ccircle 5s infinite linear;
-webkit-animation: ccircle 5s infinite linear;
}
.raindrop:hover {
animation: none;
-webkit-animation: none;
}
.axis {
width: 200px;
height: 200px;
transform: scaleX(2);
background-color: none;
border: 1px solid black;
left: 50px;
position: absolute;
top: 50px;
border-radius: 50%;
}
.rotate {
width: 100%;
height: 100%;
top: 0px;
animation: circle 5s infinite linear;
-webkit-animation: circle 5s infinite linear;
transform-origin: 50% 50%;
-webkit-transform-origin: 50% 50%;
position: absolute;
}
.counterrotate {
width: 50px;
height: 50px;
animation: ccircle 5s infinite linear;
-webkit-animation: ccircle 5s infinite linear;
}
.planet {
width: 50px;
height: 50px;
position: absolute;
border-radius : 50px;
left: 0px;
top: 0px;
background-color: red;
display: block;
}
@keyframes circle {
from { transform: rotateZ(0deg) }
to { transform: rotateZ(360deg) }
}
@-webkit-keyframes circle {
0% { -webkit-transform: rotateZ(0deg) }
100% { -webkit-transform: rotateZ(360deg) }
}
@keyframes ccircle {
from { transform: rotateZ(360deg) }
to { transform: rotateZ(0deg) }
}
@-webkit-keyframes ccircle {
from { -webkit-transform: rotateZ(360deg) }
to { -webkit-transform: rotateZ(0deg) }
}
你有这个fiddle
在其中,雨滴始终与轴div一起旋转.但它也是反转的,所以看起来是静态的.
当您将鼠标悬停时,计数旋转将被禁用,并指向红色圆圈.只要你徘徊它就会继续这样做.
要通过单击执行此操作,只需将:hover属性关联到类,然后在单击中设置此类.
内容总结
以上是互联网集市为您收集整理的使用javascript在css3中获取@keyframe当前值全部内容,希望文章能够帮你解决使用javascript在css3中获取@keyframe当前值所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。