gsap+svg实现等高线变换动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap+svg实现等高线变换动画效果代码

代码标签: 变换 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
  
<style>
html {
  height: 100%;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: #00003C;
}

svg {
  position: absolute;
  transform-origin: center;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

path {
  stroke-width: 2 !important;
  transform: scale(0.5) translate(50%, 50%);
}


svg:nth-child(2) {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
}


svg:nth-child(3) {
   width: 60%;
   height: 60%;
   top: 20%;
   left: 20%;
}

svg:nth-child(4) {
   width: 40%;
   height: 40%;
   top: 30%;
   left: 30%;
}


svg:nth-child(5) {
   width: 20%;
   height: 20%;
   top: 40%;
   left: 40%;
}

path {
  stroke: 
}
</style>


</head>

<body >
  <div>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" vector-effect="non-scaling-stroke">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.793 104.245C243.797 105.5 243.801 106.752 243.807 108.001C243.852 118.101 243.991 127.95 245.005 136.727C245.666 142.441 246.482 148.008 247.278 153.445C248.689 163.07 250.04 172.285 250.36 181.177C250.858 195.01 248.835 207.81 240.653 219.614C221.045 247.902 189.827 267.93 152.951 272.193C137.645 273.962 124.882 269.661 112.919 262.831C106.928 259.412 101.149 255.364 95.3493 251.128C93.7309 249.946 92.1094 248.748 90.4815 247.546C86.2902 244.449 82.0565 241.322 77.7239 238.352C76.5657 237.558 75.4072 236.767 74.2502 235.976C46.5285 217.033 19.6245 198.649 15.5329 163.251C13.8851 148.995 18.6231 134.126 25.637 119.856C31.0212 108.901 37.693 98.3988 43.7507 88.8632C45.5859 85.9743 47.3647 83.1742 49.0342 80.4771C58.6961 64.8691 68.0194 54.6127 79.7677 47.6739C91.5286 40.7277 105.814 37.0497 125.508 34.7733Z" stroke="url(#grad)" stroke-width="1" vector-effect="non-scaling-stroke" />
</svg>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" vector-effect="non-scaling-stroke">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.793 104.245C243.797 105.5 243.801 106.752 243.807 108.001C243.852 118.101 243.991 127.95 245.005 136.727C245.666 142.441 246.482 148.008 247.278 153.445C248.689 163.07 250.04 172.285 250.36 181.177C250.858 195.01 248.835 207.81 240.653 219.614C221.045 247.902 189.827 267.93 152.951 272.193C137.645 273.962 124.882 269.661 112.919 262.831C106.928 259.412 101.149 255.364 95.3493 251.128C93.7309 249.946 92.1094 248.748 90.4815 247.546C86.2902 244.449 82.0565 241.322 77.7239 238.352C76.5657 237.558 75.4072 236.767 74.2502 235.976C46.5285 217.033 19.6245 198.649 15.5329 163.251C13.8851 148.995 18.6231 134.126 25.637 119.856C31.0212 108.901 37.693 98.3988 43.7507 88.8632C45.5859 85.9743 47.3647 83.1742 49.0342 80.4771C58.6961 64.8691 68.0194 54.6127 79.7677 47.6739C91.5286 40.7277 105.814 37.0497 125.508 34.7733Z" stroke="url(#grad)" stroke-width="1" vector-effect="non-scaling-stroke" />
</svg>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" vector-effect="non-scaling-stroke">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.793 104.245C243.797 105.5 243.801 106.752 243.807 108.001C243.852 118.101 243.991 127.95 245.005 136.727C245.666 142.441 246.482 148.008 247.278 153.445C248.689 163.07 250.04 172.285 250.36 181.177C250.858 195.01 248.835 207.81 240.653 219.614C221.045 247.902 189.827 267.93 152.951 272.193C137.645 273.962 124.882 269.661 112.919 262.831C106.928 259.412 101.149 255.364 95.3493 251.128C93.7309 249.946 92.1094 248.748 90.4815 247.546C86.2902 244.449 82.0565 241.322 77.7239 238.352C76.5657 237.558 75.4072 236.767 74.2502 235.976C46.5285 217.033 19.6245 198.649 15.5329 163.251C13.8851 148.995 18.6231 134.126 25.637 119.856C31.0212 108.901 37.693 98.3988 43.7507 88.8632C45.5859 85.9743 47.3647 83.1742 49.0342 80.4771C58.6961 64.8691 68.0194 54.6127 79.7677 47.6739C91.5286 40.7277 105.814 37.0497 125.508 34.7733Z" stroke="url(#grad)" stroke-width="1" vector-effect="non-scaling-stroke"/>
</svg>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" vector-effect="non-scaling-stroke">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.793 104.245C243.797 105.5 243.801 106.752 243.807 108.001C243.852 118.101 243.991 127.95 245.005 136.727C245.666 142.441 246.482 148.008 247.278 153.445C248.689 163.07 250.04 172.285 250.36 181.177C250.858 195.01 248.835 207.81 240.653 219.614C221.045 247.902 189.827 267.93 152.951 272.193C137.645 273.962 124.882 269.661 112.919 262.831C106.928 259.412 101.149 255.364 95.3493 251.128C93.7309 249.946 92.1094 248.748 90.4815 247.546C86.2902 244.449 82.0565 241.322 77.7239 238.352C76.5657 237.558 75.4072 236.767 74.2502 235.976C46.5285 217.033 19.6245 198.649 15.5329 163.251C13.8851 148.995 18.6231 134.126 25.637 119.856C31.0212 108.901 37.693 98.3988 43.7507 88.8632C45.5859 85.9743 47.3647 83.1742 49.0342 80.4771C58.6961 64.8691 68.0194 54.6127 79.7677 47.6739C91.5286 40.7277 105.814 37.0497 125.508 34.7733Z" stroke="url(#grad)" stroke-width="1" vector-effect="non-scaling-stroke" />
</svg>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg" vector-effect="non-scaling-stroke">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.793 104.245C243.797 105.5 243.801 106.752 243.807 108.001C243.852 118.101 243.991 127.95 245.005 136.727C245.666 142.441 246.482 148.008 247.278 153.445C248.689 163.07 250.04 172.285 250.36 181.177C250.858 195.01 248.835 207.81 240.653 219.614C221.045 247.902 189.827 267.93 152.951 272.193C137.645 273.962 124.882 269.661 112.919 262.831C106.928 259.412 101.149 255.364 95.3493 251.128C93.7309 249.946 92.1094 248.748 90.4815 247.546C86.2902 244.449 82.0565 241.322 77.7239 238.352C76.5657 237.558 75.4072 236.767 74.2502 235.976C46.5285 217.033 19.6245 198.649 15.5329 163.251C13.8851 148.995 18.6231 134.126 25.637 119.856C31.0212 108.901 37.693 98.3988 43.7507 88.8632C45.5859 85.9743 47.3647 83.1742 49.0342 80.4771C58.6961 64.8691 68.0194 54.6127 79.7677 47.6739C91.5286 40.7277 105.814 37.0497 125.508 34.7733Z" stroke="url(#grad)" stroke-width="1" vector-effect="non-scaling-stroke" />
</svg>
  <svg width="100%" height="100%" viewBox="0 0 300 300" preserveAspectRatio="xMidYMid meet" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M125.508 34.7733C134 33.7918 143.001 31.8349 152.075 29.7666C153.226 29.5043 154.378 29.2402 155.53 28.9761C163.482 27.1529 171.453 25.3254 179.213 24.0472C197.026 21.1132 213.386 21.141 225.478 30.4819C237.962 40.1257 241.929 57.7136 243.185 77.5984C243.734 86.2834 243.764 95.3278 243.79.........完整代码请登录后点击上方下载按钮下载查看

网友评论0