【发布时间】:2015-09-20 16:29:30
【问题描述】:
我想连续翻转一个对象,我有以下代码,但这只会在悬停时翻转图像,而且只会翻转一次。我希望图像在页面加载后立即开始翻转并继续翻转直到页面关闭。请帮忙。
CSS:in表示容器,front和back表示图片的正反面
.in{
/* How pronounced should the 3D effects be */
perspective: 800px;
-webkit-perspective: 800px;
position:relative;
}
.front,
.back{
/* Enable 3D transforms */
transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
/* We are using two separate divs for the front and back of the
phone. This will hide the divs when they are flipped, so that the
opposite side can be seen: */
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
position:absolute;
/* Animate the transitions */
transition:5.8s;
}
.back{
/* The back side is flipped 180 deg by default */
transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
background-position:right center;
}
.in:hover .front{
/* When the container is hovered, flip the front side and hide it .. */
transform:rotateY(180deg);
-webkit-transform:rotateY(180deg);
}
.in:hover .back{
/* .. at the same time flip the back side into visibility */
transform:rotateY(360deg);
-webkit-transform:rotateY(360deg);
}
【问题讨论】:
标签: css css-transitions css-transforms