ユーザーが要素にカーソルを合わせると、その中に含まれる別の要素がその親を埋める単純なアニメーションを作成しようとしています。現在、私はまさにそれを行う JSFiddle を持っています。
しかし、CSS3 で実際に実行できるかどうかわからない他のいくつかの機能でこれを終了したいと思います。
内側の円で親を完全に塗りつぶす方法を見つけようとしています(つまり、幅/高さ = 300px の場合)、アニメーションが完了した後、塗りつぶしを一時停止して消えないようにしたいと思います。
ユーザーがマウスを :hover の範囲外に移動すると、アニメーションが突然停止するのではなく、方向を逆にしたいと思います。
私は CSS3 でここまでやってきましたが、Javascript に頼らずにこれら 2 つの機能を実装できるかどうかはわかりません。CSS3でこれを完全に行う方法を知っている人はいますか/ CSS3でこれらの最後の2つの機能を実行できるかどうかを知っている人はいますか.
.circle {
width: 300px;
height: 300px;
background-color: white;
border: 1px solid #000000;
overflow: hidden;
border-radius: 150px;
-moz-border-radius: 150px;
-webkit-border-radius: 150px;
}
.filler {
width: 0px;
height: 0px;
background-color: red;
border: none;
position: relative;
left: 50%;
top: 50%;
border-radius: 150px;
-mox-border-radius: 150px;
-webkit-border-radius: 150px;
animation: empty 1s;
}
.circle:hover .filler {
animation: fill 2s;
-moz-animation: fill 2s;
-webkit-animation: fill 2s;
background-color: blue;
}
@keyframes fill
{
from {background: red; height: 0px; width: 0px;}
to {background: green; height: 300px; width: 300px; top: 0%; left: 0%;}
}
@-moz-keyframes fill /* Firefox */
{
from {background: red; height: 0px; width: 0px;}
to {background: green; height: 300px; width: 300px; top: 0%; left: 0%;}
}
@-webkit-keyframes fill /* Safari and Chrome */
{
from {background: red; height:0px; width:0px;}
to {background: green; height: 300px; width: 300px; top: 0%; left: 0%;}
}
@keyframes empty
{
to {background: red; height: 0px; width: 0px; top: 50%; left: 50%;}
}
@-moz-keyframes empty
{
to {background: red; height: 0px; width: 0px; top: 50%; left: 50%;}
}
@-webkit-keyframes empty
{
to {background: red; height: 0px; width: 0px; top: 50%; left: 50%;}
}