css+svg实现熔岩灯动画效果代码

代码语言:html

所属分类:动画

代码描述:css+svg实现熔岩灯动画效果代码

代码标签: css svg 熔岩灯 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
body{
	height:100vh;
	width:100vw;
	background-image:radial-gradient(purple, #D16EA4);
	margin:0 auto;
	overflow:hidden;
}
.lamp{
	position:absolute;
	top:50%;
	left:50%;
	transform:translate(-50%,-50%);
	height:300px;
	width:300px;
}
h1{
	font-family: 'Boogaloo', cursive;
	text-align:center;
	color:rgba(255,255,255,0.05);
	font-size:5em;
	z-index:-1;
	position:absolute;
	top: 50%;
	left:50%;
	transform:translate(-50%) rotate(-4deg);
}
</style>



</head>

<body>
  <svg class="lamp" viewBox="-21 0 100 125">
	<defs>
		<filter id="goo">
			<feGaussianBlur in="SourceGraphic" stdDeviation="4" result="color-matrix-blur"></feGaussianBlur>
			<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -8" result="color-matrix-filter"></feColorMatrix>
			<feComposite in="SourceGraphic" in2="filter" operator="atop"></feComposite>
		</filter>
		<linearGradient id="glass" gradientTransform="rotate(0)">
      <stop offset="15%"  stop-color="rgba(255,255,255,0)" />
      <stop offset="95%" stop-color="rgba(255,255,255,0.3)" />
    </linearGradient>
		<linearGradient id="silver" gradientTransform="rotate(0)">
      <stop offset="15%"  stop-color="rgb(102,102,102)" />
      <stop offset="95%" stop-color="rgb(192,192,192)" />
    </linearGradient>
	</defs>
	<g class="gloops" filter="url(#goo)">
		<ellipse rx="10%" ry="10%" class="circle" fill="rgb(205,46,43)">
			<animate attributeName="cx" values="28%; 33%; 28%" dur="12s" repeatCount="indefinite" />
			<animate attributeName="cy" values="16%; 69%; 16%" dur="12.2s" repeatCount="indefinite" keyTimes="0;0.6;1" />
			<animate attributeName="rx" values="7%; 4%; 7%" dur="10.4s" begin="-1" repeatCount="indefinite" />
			<animate attributeName="ry" values="7%; 4%; 7%" dur="19.4s" begin="-3" repeatCount="indefinite" />
			<animate attributeName="fill" values="rgb(225,66,43); rgb(205,46,43); rgb(225,66,43)" dur="10s" begin="-1" repeatCount="indefinite" />
		</ellipse>
		<ellipse r="10%" class="circle" fil.........完整代码请登录后点击上方下载按钮下载查看

网友评论0