<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>CSS3动画</title> <style type="text/css"> div{ height: 50px; width: 50px; background: pink; /*调用动画*/ animation:animates 5s linear 1s 2; } /*创建 关键帧*/ @keyframes animates{ 0%{ width: 0px; transform: translate(50px,0); } 25%{ width: 25px; height: 25px; transform: translate(150px,0) rotate(90deg); } 50%{ width: 50px; height: 50px; transform: translate(300px,0) rotate(180deg); } 75%{ width: 25px; height: 25px; transform: translate(150px,0) rotate(270deg); } 100%{ width: 50px; height: 50px; transform: translate(50px,0) rotate(360deg); } } </style> </head> <body> <div></div> </body> </html>
来源:https://www.cnblogs.com/zwy0709/p/7774806.html