試圖重新創建https://daneden.github.io/animate.css/上的按鈕輪廓效果。我試圖查看代碼,但無法弄清楚什麼是觸發什麼,所以我從一些教程中創建了顏色變化效果,然後從animate.css頁面中剝離了按鈕樣式的CSS並將它們合併在一起。彩色動畫已應用於按鈕,但我似乎無法解決的是如何將該彩色動畫應用於輪廓和內部文本。我也想知道如何讓顏色變化更加漸進,即使在增加動畫持續時間之後它仍然感覺過於突然。如何在按鈕輪廓上有顏色更改動畫?
我嘗試: http://codepen.io/Dingerzat/pen/pNNgZj
/* CSS */
.modal__button {
-webkit-animation: hue 60s linear;
-o-animation: hue 60s linear;
animation: hue 60s linear;
background-color: transparent;
border: 2px solid #f35626;
color: #f35626;
cursor: pointer;
font-size: 15px;
outline: none;
padding: 7px 22px;
-webkit-transition: background-color .4s, color .4s;
-o-transition: background-color .4s, color .4s;
transition: background-color .4s, color .4s;
}
.color {
animation-name: color_change;
animation-duration: 10s;
animation-iteration-count: infinite;
animation-direction: alternate;
}
@-webkit-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
@-moz-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
@-ms-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
@-o-keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
@keyframes color_change {
0% { background-color: #da6e16; }
25% { background-color: #82da16; }
50% { background-color: #16dad0; }
75% { background-color: #d41a82; }
100% { background-color: #d41a82 }
}
<!-- HTML -->
<button class="modal_button color">ddd</button>
你可以設置「邊界」和「顏色」 – Anan