anya-ji's picture
Add files using upload-large-folder tool
c3d5f0d verified
Raw History Blame Contribute Delete
5.02 kB
<!DOCTYPE html>
<html>
<head>
<style>body {
background-color:#e5e5e5;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
body,
html {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
svg{
width:100%;
height:100%;
visibility:hidden;
}
#rockClone{
mix-blend-mode: overlay;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js"></script>
</head>
<body>
<svg class="mainSVG" 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="600px" height="600px" viewBox="0 0 600 600" >
<defs>
<filter id="edgeClean" color-interpolation-filters="sRGB">
<feComponentTransfer>
<feFuncA type="table" tableValues="0 .5 1 1" />
</feComponentTransfer>
</filter>
<filter id="goo" color-interpolation-filters="sRGB">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" 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 21 -9" result="cm" />
<feComposite in="SourceGraphic" in2="cm" />
</filter>
<filter id="rockFilter">
<!--<feColorMatrix in="SourceGraphic" type="hueRotate" values="30" />-->
<feColorMatrix in="SourceGraphic" type="matrix" values="1 0 0 0
0 0 1 0
0 0 1 0
0 0 0 0
0 0 1 0"/>
</filter>
<filter id="reflection">
<feTurbulence id="turbulence" baseFrequency="0.01 0.8" type="fractalNoise" stitchTiles="stitch" numOctaves="1" seed="0"/>
<feDisplacementMap in="SourceGraphic" scale="50" />
<feGaussianblur stdDeviation="0.7" >
</feGaussianblur>
</filter>
<clipPath id="rippleMask">
<rect width="600" height="200" y="300" />
</clipPath>
</defs>
<g id="rippleGroup" filter="url(#goo)" fill="none" stroke="#6BCCD5" stroke-width="2" stroke-miterlimit="10" >
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
<ellipse cx="300" cy="310" rx="36" ry="12"/>
</g>
<g id="rockGroup" filter="url(#edgeClean)">
<path fill="#333333" d="M404.6,310.7l-65-76.6l35-5.8C374.6,228.3,396.3,285.7,404.6,310.7z"/>
<path fill="#383838" d="M339.5,234.1l64.9,76.6c-18.1,9.2-47.4,13-79.4,13.6v-0.1L339.5,234.1z"/>
<path fill="#3D3D3D" d="M374.6,228.3l-35,5.8l-75.8-35.8L374.6,228.3z"/>
<path fill="#3F3F3F" d="M339.5,234.1L325,324.2v0.1c-8,0.2-16.4,0.1-24.6-0.1l-68.6-49.6L339.5,234.1z"/>
<path fill="#474747" d="M339.6,234.1l-107.7,40.5l31.9-76.3L339.6,234.1z"/>
<path fill="#474747" d="M231.9,274.6l68.6,49.6c-45.9-1.3-89.3-8.1-98.3-13.5l-5.8-14.2L231.9,274.6z"/>
<path fill="#505050" d="M263.9,198.3l-31.9,76.3l-35.5,21.9L263.9,198.3z"/>
</g>
</svg>
<script>var xmlns = "http://www.w3.org/2000/svg",
select = function(s) {
return document.querySelector(s);
},
selectAll = function(s) {
return document.querySelectorAll(s);
},
mainSVG = select('.mainSVG'),
rockGroup = select('#rockGroup'),
rippleGroup = select('#rippleGroup'),
rockClone = rockGroup.cloneNode(true);
mainSVG.appendChild(rockClone);
mainSVG.appendChild(rockGroup)
TweenMax.set(rockClone, {
transformOrigin:'50% 90%',
scaleY:-0.5,
alpha:0.4,
filter:'url(#reflection)'
})
rockClone.id="rockClone"
TweenMax.set('svg', {
visibility:'visible',
scale:1.1
})
TweenMax.set('#rockClone path', {
filter:'url(#rockFilter)'
})
var tl = new TimelineMax({repeat:0});
tl.staggerFromTo('#rippleGroup ellipse', 32, {
cycle:{
attr:function(i){
var destRX = randomBetween(15, 60);
TweenMax.set(this, {
strokeWidth:randomBetween(0, 4),
stroke:"hsl(+=" +randomBetween(13, 25)+ ", +=0%, +=0%)"
})
return {rx:destRX, ry:0};
} }
},{
cycle:{
attr:function(i){
var destRX = randomBetween(200, 300);
return {rx:destRX, ry:destRX/6};
} },
ease:Sine.easeOut,
stroke:'#e5e5e5',
repeat:-1
}, 6)
.to('#rippleGroup ellipse', tl.duration(),{
alpha:0
},'-='+ tl.duration())
tl.time(2000);
TweenMax.to(turbulence, 10, {
attr:{
seed:80
},
repeat:-1,
yoyo:true,
ease:Linear.easeNone
})
function randomBetween(min,max)
{
return Math.floor(Math.random()*(max-min+1)+min);
}</script>
</body>
</html>