Chart One
Chart Two
Chart Three on click example
svg{
width:30%;
display:block;
margin:0 auto;
margin-top:1%;
margin-bottom:19%;
}
div{
margin:0 auto;
display:block;
width:60%;
}
h1{
font-family:"Avenir", Monospace;
font-size:1.5em;
font-weight:normal;
text-align:center;
}
.triangle{
stroke:#6299DB;
stroke-width:6;
}
.blueChartLine{
stroke:#FAFAFA;
}
button{
background:#6CA6EB;
border:none;
color:white;
font-family:"Avenir", Monospace;
text-transform:uppercase;
font-size:0.9em;
padding:1% 2% 1% 2%;
text-align:center;
display:block;
margin:0 auto;
margin-top:-10%;
margin-bottom:5%;
}
//
var tl = new TimelineMax();
tl.staggerFrom(".graphLine", 1, { opacity:0, y:20, ease: Elastic.easeOut.config(1.5,0.5) }, 0.15)
.from(".chartLine", 0.2, { opacity:0, });
tl.repeat(-1).yoyo(false).repeatDelay(1).play();
//
var tlRed = new TimelineMax();
tlRed.staggerFrom(".redChartLine", 1.3, { opacity:0, y:-80, ease: Elastic.easeOut.config(1.5,0.5) }, 0.15)
.from(".redChart", 0.8, { rotation:860, transformOrigin:"50% 50%", opacity:0, scale:0.2 });
tlRed.repeat(-1).yoyo(false).repeatDelay(1).play();
//
//
var blueAni = function(){
var path = document.querySelector('.blueChartLine');
var length = path.getTotalLength();
path.style.transition = path.style.WebkitTransition =
'none';
path.style.strokeDasharray = length + ' ' + length;
path.style.strokeDashoffset = length;
path.getBoundingClientRect();
path.style.transition = path.style.WebkitTransition =
'stroke-dashoffset 2s ease-in-out';
path.style.strokeDashoffset = '0';
};
//
var blueAniTriangle = function(){
var pathTwo = document.querySelector('.triangle');
var lengthTwo = pathTwo.getTotalLength();
pathTwo.style.transition = pathTwo.style.WebkitTransition =
'none';
pathTwo.style.strokeDasharray = lengthTwo + ' ' + lengthTwo;
pathTwo.style.strokeDashoffset = lengthTwo;
pathTwo.getBoundingClientRect();
pathTwo.style.transition = pathTwo.style.WebkitTransition =
'stroke-dashoffset 2s ease-in-out';
pathTwo.style.strokeDashoffset = '0';
};