1. 程式人生 > 其它 >css3中的animation的動畫幀製作-卡通人物的走動效果

css3中的animation的動畫幀製作-卡通人物的走動效果

技術標籤:網頁設計css3html網頁設計animation關鍵幀

css3中的animation的動畫幀製作-卡通人物的走動效果

在這裡插入圖片描述
程式碼如下;

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title
>
animation動畫幀</title> <style> div{ width: 185px; height: 300px; margin-top: 100px; margin-left: 1300px; /* border: brown 1px solid; */ background: url(images/charector.png) no-repeat ; /* background-size: 185px 300px; */
animation: run 1.5s infinite step-end; } @keyframes run{ 0%{ opacity: 1; background-position: 0px; transform: translateX(-185px); } 16.66%{ opacity: 0.9; background-position
: -160px; transform: translateX(-370px); } 33.33%{ opacity: 0.8; background-position: -336px; transform: translateX(-555px); } 49.98%{ opacity: 0.6; background-position: -520px; transform: translateX(-740px); } 66.64%{ opacity: 0.4; background-position: -700px; transform: translateX(-925px); } 88.3%{ opacity: 0.2; background-position: -900px; transform: translateX(-1110px); } 100%{ background-position: -1100px; transform: translateX(-1295px); opacity: 0; } }
</style> </head> <body> <div class="box"> </div> </body> </html>