.btn-anim{ transition: all .5s; position: relative; overflow: hidden !important; box-shadow: 0px 1px 2px rgba(0,0,0,.2); } .btn-anim span{ position: absolute; display: block; } .btn-anim span:nth-child(1){ height: 3px; width:200px; top:0px; left:-200px; background: linear-gradient(to right, rgba(0,0,0,0), #f00); border-top-right-radius: 25px; border-bottom-right-radius: 25px; animation: span1 2s linear infinite; animation-delay: 0s; } @keyframes span1{ 0%{ left:-200px } 100%{ left:200px; } } .btn-anim span:nth-child(2){ height: 70px; width: 3px; top:-70px; right:0px; background: linear-gradient(to bottom, rgba(0,0,0,0), #f00); border-bottom-left-radius: 25px; border-bottom-right-radius: 25px; animation: span2 2s linear infinite; animation-delay: 0s; } @keyframes span2{ 0%{ top:-70px; } 100%{ top:70px; } } .btn-anim span:nth-child(3){ height:3px; width:200px; right:-200px; bottom: 0px; background: linear-gradient(to left, rgba(0,0,0,0), #f00); border-top-left-radius: 25px; border-bottom-left-radius: 25px; animation: span3 2s linear infinite; animation-delay: 0s; } @keyframes span3{ 0%{ right:-200px; } 100%{ right: 200px; } } .btn-anim span:nth-child(4){ height:70px; width:3px; bottom:-70px; left:0px; background: linear-gradient(to top, rgba(0,0,0,0), #f00); border-top-right-radius: 25px; border-top-left-radius: 25px; animation: span4 2s linear infinite; animation-delay: 0s; } @keyframes span4{ 0%{ bottom: -70px; } 100%{ bottom:70px; } }