anya-ji's picture
Duplicate from anim2code/dataset
2086c64
Raw History Blame Contribute Delete
2.39 kB
<!DOCTYPE html>
<html>
<head>
<style>body{
background-color:#565554;
overflow:hidden;
}
body, html, #container {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
svg{
position:absolute;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.15.1/TweenMax.min.js"></script>
</head>
<body>
<div id="container">
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="400" height="75%" viewBox="0 0 400 200" enable-background="new 0 0 400 200"
xml:space="preserve">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="7" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 17 -7" result="cm" />
<feComposite in="SourceGraphic" in2="cm" >
</filter>
</defs>
<g filter="url(#goo)" style="fill:#FE5621">
<ellipse id="source" cx="300" cy="0" rx="20" ry="20"/>
<ellipse id="drop" cx="300" cy="90" rx="10" ry="10"/>
<ellipse id="drop2"cx="250" cy="90" rx="10" ry="10"/>
<ellipse id="drop3"cx="200" cy="90" rx="10" ry="10"/>
<ellipse id="drop4"cx="150" cy="90" rx="10" ry="10"/>
</g>
<line x1=103 x2=320 y1=100 y2=100 stroke='#B5B5B5' stroke-width='1'/>
</svg>
</div>
<script>var container = document.getElementById('container');
var source = document.getElementById('source');
var drop = document.getElementById('drop');
var drop2 = document.getElementById('drop2');
var drop3 = document.getElementById('drop3');
var drop4 = document.getElementById('drop4');
TweenMax.set([container, 'svg'], {
position:'absolute',
top:'50%',
left:'50%',
xPercent:-50,
yPercent:-50
})
TweenMax.set(drop, {
transformOrigin:'50% 100%'
})
var tl = new TimelineMax({repeat:-1});
tl.timeScale(2.6);
tl.fromTo(drop, 2, {
attr:{
cy:10
}
}, {
attr:{
cy:90
},
ease:Power4.easeIn
})
.to(drop, 0.05, {
scaleX:1.3,
scaleY:0.6,
ease:Linear.easeNone
})
.to(drop, 1.5, {
scaleX:1,
ease:Elastic.easeOut
})
.to(drop, 1, {
scaleY:1,
ease:Elastic.easeOut
}, '-=1.5')
.to([drop, drop2, drop3, drop4], 2,{
attr:{
cx:'-=50'
},
ease:Back.easeInOut
}, '-=2')
.to(drop4, 0.8, {
attr:{
cy:'+=100',
rx:8
},
ease:Power3.easeIn
}, '-=0.8')
</script>
</body>
</html>