HTML
CSS3 animation 動畫屬性是 CSS 用來設計網頁動畫的標準屬性, 用來控制動畫的移動方式、顏色變化、移動方向、顏色變化 ... 等效果。 animation:name duration function delay count direction mode state @keyframes 動畫名稱{ 10%{..動作..} 50%{..動作..} 100%{..動作..} }
#D1{ width: 100px; height: 100px; background-color: red; position: relative; animation : MO1 4s infinite ; } @keyframes MO1{ 0% {background-color:red; left:0px; top:0px;} 25% {background-color:yellow; left:87%; top:0px;} 50% {background-color:blue; left:87%; top:75%;} 75% {background-color:green; left:0px; top:75%;} 100% {background-color:red; left:0px; top:0px;} } #D2{ width: 100px; height: 100px; background-color: red; position: relative; animation : MO2 4s infinite ; } @keyframes MO2{ 0% {background-color:yellow; left:87%; top:-100px;} 25% {background-color:blue; left:0px; top:50%;} 50% {background-color:red; left:0%; top:-100px;} 75% {background-color:gold; left:87%; top:50%;} 100% {background-color:olive; left:87%; top:-100px;} }
.text { animation: mymove 1s infinite; } @keyframes mymove { 60% {color:crimson; } 80% {color:yellow; } 90% {color:orange; } 100% {color:brown; } }
.bomb{ width:100px; text-align: center; background-color:#CCCCCC; border: 5px outset darkgray; border-radius: 15px; cursor:pointer} .bomb:active { border: 5px inset darkgray; } .bomb:after { content: ">"; animation: Rafter 1s linear infinite ;} .bomb:before { content: "<"; animation: Lbefore 1s linear infinite ;} @keyframes Rafter{ 10% { content: ">>"; } 50% { content: ">>>"; } 90% { content: ">>"; } } @keyframes Lbefore { 10% { content: "<<"; } 50% { content: "<<<"; } 90% { content: "<<"; } }