html - Transitioning a circle to show -


i attempting make borders of circle 2 different points start @ x axis of circle , 0%-100% keyframes join connect.

i figured out how create circle outer div , broke different quadrants. 1, 2, 3 , 4. however, right borders quadrants displaying on 1 line rather taking on border of circle.

how can make quadrants borders show in circle.

i have created illustration of trying below, shown have done far.

enter image description here

.outer {    border-radius: 50%;    height: 500px;    width: 500px;    border: 1px solid #e0e0e0;    position: relative;  }    .quad1,  .quad2 {    left: 50%;    border: 5px solid #e0e0e0;    transform-origin: left bottom;      -webkit-animation: circle 4s 1 normal forwards;    animation: circle 4s 1 normal forwards;  }    .quad3,  .quad4 {    left: 0%;    border: 5px solid #e0e0e0;    transform-origin: right top;      -webkit-animation: circle 4s 1 normal forwards;    animation: circle 4s 1 normal forwards;  }    .quad1,  .quad4 {    top: 0%;    border: 5px solid #e0e0e0;      -webkit-animation: circle 4s 1 normal forwards;    animation: circle 4s 1 normal forwards;  }    .quad2,  .quad3 {    top: 50%;    border: 5px solid #e0e0e0;      -webkit-animation: circle 4s 1 normal forwards;    animation: circle 4s 1 normal forwards;  }      @-webkit-keyframes circle {    0%   { opacity: 0; }    100% { opacity: 1; }  }    @keyframes circle {    0%   { opacity: 0; }    100% { opacity: 1; }  }
<div class="outer">    <div class="quad1"></div>    <div class="quad2"></div>    <div class="quad3"></div>    <div class="quad4"></div>  </div>

this bit tricky, fun problem.

there 4 quarter-circles. 2 of them rotate 90˚ , other 2 rotate 180˚ in twice time. there 2 masks hide quarter-circles in quadrants 2 , 4 until have rotated 90˚, @ point masks' z-indexes change no longer hide quarter-circles.

check out working fiddle: https://jsfiddle.net/3x2l47lv/4/

<div class="wrapper">     <div class="spinner top topright"></div>     <div class="spinner top topleft"></div>     <div class="spinner bottom bottomleft"></div>     <div class="spinner bottom bottomright"></div>     <div class="mask q2"></div>     <div class="mask q4"></div> </div> 

body {     background-color: white; }  .wrapper {     width: 250px;     height: 250px;     position: relative;     background: inherit; }  .spinner {     width: 125px;     height: 125px;     position: absolute;     border: 5px solid black;     z-index: 10; }  .top {     top: 130px;     left: 130px;     border-radius: 0 0 130px 0;     border-left: none;     border-top: none;     transform-origin: top left; }  .bottom {     border-radius: 130px 0 0 0;     border-bottom: none;     border-right: none;     transform-origin: bottom right; }  .topright, .bottomleft {     animation: rotate90 2s linear forwards; }  .topleft, .bottomright {     animation: rotate180 4s linear forwards; }  .mask {     width: 130px;     height: 130px;     position: absolute;     opacity: 1;     background: inherit;     z-index: 15;     animation: mask 4s linear forwards; }   .q2 {     top: 0;     left: 0; }  .q4 {     top: 130px;     left: 130px; }   @keyframes rotate90 {     0%   { transform: rotate(0deg); }     100% { transform: rotate(-90deg); } }  @keyframes rotate180 {     0%   { transform: rotate(0deg); }     100% { transform: rotate(-180deg); } }  @keyframes  mask {     0%   {z-index: 15}     100% {z-index: 4} } 

updated:

if want complete circle, reverse, can make animation times same, change @keyframes following:

@keyframes rotate90 {     0%       { transform: rotate(0deg); }     25%, 75% { transform: rotate(-90deg); }     100%     { transform: rotate(0deg); } }  @keyframes rotate180 {     0%  { transform: rotate(0deg); }     50% { transform: rotate(-180deg); }    100% { transform: rotate(0deg); } }  @keyframes  mask {     0%  {z-index: 15}     50% {z-index: 4}    100% {z-index: 15} } 

fiddle example effect reversing: https://jsfiddle.net/3x2l47lv/6/


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -