2016-11-24 60 views
1

我試圖動畫一些文本是否可以動畫-webkit-text-fill-color?

h1 { 
 
    font-family: sans-serif; 
 
\t color: black; 
 
\t animation: danger-zone 3s linear infinite; 
 
\t animation-direction: alternate; 
 
    font-size:60px; 
 
    
 
\t -webkit-text-stroke-width: 2px; 
 
} 
 

 
@keyframes danger-zone { 
 
\t 0% { 
 

 
\t \t -webkit-text-fill-color: black; 
 
\t \t -webkit-text-stroke-color: black; 
 
\t } 
 

 
\t 100% { 
 
\t \t 
 
\t \t -webkit-text-fill-color: white; 
 
\t \t -webkit-text-stroke-color: white; 
 
\t } 
 
}
<h1>Here's a title!</h1>

出於某種原因,只是行程似乎動畫,並填充顏色只是在切換(我猜)的50%。是否可以在CSS中爲填充顏色設置動畫效果?

編輯:它似乎在Firefox中,而不是鉻。要測試其他一些瀏覽器現在

回答

1

看來,鉻犯規像-color後綴,試試這個:

h1 { 
 
    font-family: sans-serif; 
 
    color: black; 
 
    animation: danger-zone 3s linear infinite; 
 
    animation-direction: alternate; 
 
    font-size: 60px; 
 
    -webkit-text-stroke-width: 2px; 
 
} 
 
@keyframes danger-zone { 
 
    0% { 
 
    color: black; 
 
    -webkit-text-stroke: 2px black; 
 
    } 
 
    100% { 
 
    color: white; 
 
    -webkit-text-stroke: 2px white; 
 
    } 
 
}
<h1>Here's a title!</h1>

+0

完美!我不敢相信我沒有想到這樣做...... –

相關問題