我試圖做一個CSS動畫(我不能使用JavaScript)通過以下步驟:CSS動畫的div移動到頂部,然後到中心
有一個div其中,你不能預先知道其位置或大小(在小提琴我已設置用於測試的大小)
在div被調整大小(寬度100%的高度50個像素),並移動到頁面的頂部,而其內容消失
該div變成一個圓圈並移動到該中心
這是我迄今爲止嘗試頁:
https://jsfiddle.net/v3bt1mar/5/
.turning {
width: 80%;
height: 120px;
background-color: #00FF00;
}
.turning:active {
background: red;
animation: 10.5s;
display: block !important;
position: fixed;
content: "";
overflow: hidden;
animation: resizeList 10.5s forwards;
}
.turning:active * {
animation: fadeContent 1s forwards;
}
@keyframes fadeContent {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 0;
}
}
@keyframes resizeList {
25% {
width: 100%;
height: 50px;
top: 10px;
left: 0%;
// transform: translate(0%, 0%) rotateY(0deg);
border-radius: 0%;
}
100% {
border-radius: 50%;
top: calc(50% - 50px);
left: calc(50% - 50px)";
// transform: translate(~"calc(50vw - 50px)", ~"calc(50vh - 50px)") rotateY(180deg);
transform: rotateY(180deg);
width: 100px;
height: 100px;
}
}
但它是從什麼,我期待仍遠。
在Mozilla上它不會垂直移動,在Chrome上它移動但不平滑(顯然在每個關鍵幀處)
然後我不知道爲什麼它會移回頁面的中心而不是左側 更重要的是它的工作方式不同在Mozilla和Chrome頂部(在Mozilla不會移動到頂端,在Chrome它,但不順利)
你想要什麼? –
要知道我在我的css中缺少的是爲了使它按照我想要的方式工作 – valepu
要移除lagginess? –