CSS animation for moving div to top and then to center -
i trying make css animation (i can't use javascript) these steps:
have div of can't know in advance position or size (in fiddle have set size testing)
the div gets resized (width 100% height 50 pixels) , moves top of page while content disappears
the div turns circle , moves center of page
this have attempted far:
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; } }
but it's still far expecting.
on mozilla doesn't move vertically, on chrome move not smoothly (just @ every keyframe, apparently)
don't know why moves left rather center of page on top of works differently on mozilla , chrome (on mozilla doesn't move top, on chrome not smoothly)
if add position:absolute;
.turning
, remove rotate transformation in keyframe, animation describing: https://jsfiddle.net/v3bt1mar/7/
Comments
Post a Comment