Datasets:
File size: 2,897 Bytes
c3d5f0d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | <!DOCTYPE html>
<html>
<head>
<style>body {
background-color: #303969;
overflow: hidden;
}
body,
html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
.container {
width: 600px;
height: 600px;
}</style>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/DrawSVGPlugin.js?r=12"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>
</head>
<body>
<div class="container">
<svg version="1.1" width="600px" height="600px">
<defs>
<mask id="liquidMask" x="0" y="-50" width="121" height="189">
<path fill="rgba(255,255,255,0.85)" d="M354.6,371.5h-82.2c-2.2,0-4-1.8-4-4l-15.8-180.9c0-2.2,1.8-4,4-4h113c2.2,0,4,1.8,4,4 l-15,180.9C358.6,369.8,356.8,371.5,354.6,371.5z" />
</mask>
</defs>
<svg class="glassSVG" x="-400" y="0">
<path class="glass" opacity="0.08" fill="#FFFFFF" d="M363.9,383.1H260.5c-3.6,0-6.6-3-6.6-6.6l-15.2-188.1
c0-3.6,3-6.6,6.6-6.6h135.5c3.6,0,6.6,3,6.6,6.6l-17,188.1C370.5,380.1,367.5,383.1,363.9,383.1z" />
<polygon class="reflection" opacity="0.2" fill="#FFFFFF" points="298.9,383.1 270,383.1 251,181.8 279.9,181.8 " />
<g class="liquidGroup" mask="url(#liquidMask)" x="0" y="0">
<g class="beerHeadGroup">
<rect class="beer" x="178.3" y="272.3" fill="#FFB241" width="294" height="164.7" />
<rect class="head" x="178.3" y="245" fill="#FFEBD3" width="294" height="29.3" />
</g>
</g>
<circle class="splash" cx="268" cy="260" r="6" fill="#E5D1C4" />
</svg>
</svg>
</div>
<script>var container = document.querySelector('.container');
var beerHeadGroup = document.querySelector('.beerHeadGroup');
var glassSVG = document.querySelector('.glassSVG');
var splash = document.querySelector('.splash');
TweenMax.set(container, {
position: 'absolute',
top: '50%',
left: '50%',
xPercent: -50,
yPercent: -50
})
var tl = new TimelineMax({
repeat: -1
});
tl.set(beerHeadGroup, {
rotation: 0
})
.to(glassSVG, 2, {
attr: {
x: 0
},
ease: Power4.easeInOut
})
.to(splash, 0.3, {
attr: {
cy: 210
},
scaleY: 1.6,
ease: Power1.easeInOut
}, '-=1.2')
.to(splash, 0.2, {
attr: {
cy: 270
},
scaleY: 1,
ease: Power4.easeIn
}, '-=0.9')
.set(splash, {
attr: {
r: 0
}
}, '-=0.65')
.fromTo(beerHeadGroup, 1, {
rotation: 0
}, {
rotation: 29,
transformOrigin: '50% 50%',
ease: Power4.easeIn
}, '-=2')
.fromTo(beerHeadGroup, 4, {
rotation: 29
}, {
rotation: 0,
transformOrigin: '50% 50%',
ease: Elastic.easeOut.config(1.6, 0.12)
}, '-=.9')
.to(glassSVG, 1, {
attr: {
x: 400
},
ease: Power4.easeInOut
})
.fromTo(beerHeadGroup, 0.6, {
rotation: 0
}, {
rotation: 26,
transformOrigin: '50% 50%',
ease: Power4.easeIn
}, '-=1')</script>
</body>
</html> |