如何将线条或图像从底部旋转到180度

时间:2014-09-15 04:57:48

标签: html5 css3 animation

我有这个代码从中间旋转hr(一条线),我想从它的底部旋转那条线

<!DOCTYPE html>
<html>
<head>
<style> 
#myDIV {
    margin: auto;
   width: 50px;
    background-color: coral;
    color: white;
    -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
    animation: mymove 5s infinite;
}

/* Chrome, Safari, Opera */
@-webkit-keyframes mymove {
    50% {-webkit-transform: rotate(180deg);}
}

/* Standard syntax */
@keyframes mymove {
    50% {transform: rotate(180deg);}
}
</style>
</head>
<body>

<p>Gradually rotate the DIV element 180 degrees, and back:<p>
<div id="myDIV">
<hr>
</div>

如何从底部旋转线条或图像,就像拨打其旋转的拨号

一样

1 个答案:

答案 0 :(得分:2)

你可以尝试一下。

#myDIV {
    margin: auto;
   width: 50px;
    background-color: coral;
    color: white;
    -webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
    animation: mymove 5s infinite;
    transform-origin: top left;
}


@-webkit-keyframes mymove {
    50% {-webkit-transform: rotate(180deg);}

}

@keyframes mymove {
    50% {transform: rotate(180deg);}
}

并根据需要更改transform-origin值,它可以是数字。