<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>帧动画</title>
<style type="text/css">
#div1 {
width: 100px;
height: 100px;
background: -webkit-radial-gradient(circle, orange, green);
background: radial-gradient(circle, orange, green);
border-radius: 50%;
/* 动画名称,运行时间,无限循环 */
/* animation: move 1s infinite; */
/* 动画名称,运行时间,运行次数,反方向运行 */
/* animation: move 1s 1 reverse; */
/* 动画名称,运行时间,运行次数,交替运行 */
animation: move 1s 2 alternate;
}
#div1:hover {
/* 鼠标划过时停止 */
animation-play-state: paused;
}
@-webkit-keyframes move {
0% {
transform: translate(0, 0);
}
50% {
transform: translate(400px, 400px);
}
100% {
transform: translate(400px, 0);
}
}
</style>
</head>
<body>
<div id="div1"></div>
</body>
</html>
来源:CSDN
作者:jamesge2010
链接:https://blog.csdn.net/jamesge2010/article/details/104595779