Skip to content

Instantly share code, notes, and snippets.

@zackperdue
Created May 7, 2015 13:57
Show Gist options
  • Save zackperdue/3e8016aee49971c77a47 to your computer and use it in GitHub Desktop.
Save zackperdue/3e8016aee49971c77a47 to your computer and use it in GitHub Desktop.
ReactJS CSS3 Animated Loading Icon
.spinner {
margin: 100px auto;
width: 50px;
height: 30px;
text-align: center;
font-size: 10px;
opacity: .5;
}
.spinner > div {
background-color: #3399cc;
height: 100%;
width: 6px;
display: inline-block;
margin-right: 3px;
-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
animation: stretchdelay 1.2s infinite ease-in-out;
}
.spinner .rect2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.spinner .rect3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.spinner .rect4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.spinner .rect5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes stretchdelay {
0%, 40%, 100% { -webkit-transform: scaleY(0.4) }
20% { -webkit-transform: scaleY(1.0) }
}
@keyframes stretchdelay {
0%, 40%, 100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
} 20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}
var LoadingIcon = React.createClass({
render: function(){
return (
<div className="spinner">
<div className="rect1"></div>
<div className="rect2"></div>
<div className="rect3"></div>
<div className="rect4"></div>
<div className="rect5"></div>
</div>
)
}
})
@zackperdue
Copy link
Author

Super easy to use this loading icon...

<LoadingIcon />

@zackperdue
Copy link
Author

Btw, if you want to get more loaders, check out this page! Really cool resource: http://tobiasahlin.com/spinkit/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment