svg+gsap实现带音效圣诞老人拖拉进入盒子动画代码

代码语言:html

所属分类:动画

代码描述:svg+gsap实现带音效圣诞老人拖拉进入盒子动画代码

代码标签: svg gsap 音效 圣诞 老人 拖拉 进入 盒子

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


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

<head>

  <meta charset="UTF-8">


  <meta name="viewport" content="width=device-width, initial-scale=1">
  
  
  
<style>
@import url('https://fonts.googleapis.com/css2?family=Mountains+of+Christmas:wght@700&display=swap');

body, html {
  margin: 0;
  padding: 0,
  height: 100vh;
  background-color: #ece9f0;
  font-family: 'Mountains of Christmas', cursive;
}

svg {
  position: fixed;
  height: 95vh;
  bottom: 0;
  left: 50%;
  transform: translate(-50%);
  max-height: 900px;
  overflow: visible;
}

.scene {
    opacity: 0;
  position: relative;
}

#santa {
  cursor: pointer;
}

h2, p {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  text-align: center;
  font-size: 5vw;
  opacity: 0.8
}

.merry, .ho {
  opacity: 0
}

@media only screen and (max-width: 600px) {
  svg {
    height: 70vh
  }
}
</style>


</head>

<body  >
  <div class="scene">
  <h2 class="text intro">Santa's stuck! Help to pull him out...</h2>
  <p class="text ho">HO HO HOORAY!</p>
  <p class="text merry">Merry Christmas from the GSAP team!</p>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 440.47 736.94">
    <defs>
      <clipPath id="clip-path">
        <rect x="177.25" y="600.55" width="82.26" height="6.02" fill="none" />
      </clipPath>
      <clipPath id="clip-path-2">
        <rect id="SVGID" x="171.73" y="619.68" width="95.97" height="89.5" fill="none" />
      </clipPath>
      <clipPath id="clip-path-3">
        <polygon id="SVGID-2" fill="none" points="356.1 709.81 387.98 502.19 398.7 503.61 375.66 712.39 356.1 709.81 356.1 709.81" data-name="SVGID" />
      </clipPath>
    </defs>
    <g id="pole">
      <polygon points="356.1 709.81 387.98 502.19 398.7 503.61 375.66 712.39 356.1 709.81 356.1 709.81" fill="#fff" />
      <g clip-path="url(#clip-path-3)">
        <g id="progress">
          <rect x="330.82" y="690.46" width="70.16" height="9.48" transform="translate(527.83 -73.54) rotate(39.65)" fill="#d04f6c" />
          <rect x="333.63" y="669.1" width="70.16" height="9.48" transform="translate(514.85 -80.25) rotate(39.65)" fill="#d04f6c" />
          <rect x="336.45" y="647.75" width="70.16" height="9.48" transform="translate(501.87 -86.96) rotate(39.65)" fill="#d04f6c" />
          <rect x="339.27" y="626.39" width="70.16" height="9.48" transform="translate(488.89 -93.68) rotate(39.65)" fill="#d04f6c" />
          <rect x="342.09" y="605.04" width="70.16" height="9.48" transform="translate(475.91 -100.39) rotate(39.65)" fill="#d04f6c" />
          <rect x="344.9" y="583.68" width="70.16" height="9.48" transform="translate(462.93 -107.1) rotate(39.65)" fill="#d04f6c" />
          <rect x="347.72" y="562.32" width="70.16" height="9.48" transform="translate(449.95 -113.81) rotate(39.65)" fill="#d04f6c" />
          <rect x="350.54" y="540.97" width="70.16" height="9.48" transform="translate(436.97 -120.52) rotate(39.65)" fill="#d04f6c" />
          <rect x="353.35" y="519.61" width="70.16" height="9.48" transform="translate(423.99 -127.23) rotate(39.65)" fill="#d04f6c" />
        </g>
      </g>
      
      <circle id="light" cx="393.93" cy="498.47" r="12.12" transform="translate(-222.95 346.44) rotate(-37.84)" fill="white" />
      <g clip-path="url(#clip-path-4)">
        <path d="M389.58,489.68a2.57,2.57,0,0,1,2.58-.14c1.53,1,1.08,4,2.86,4.4,1.21.27,2.12-1,3.23-1.6a3.61,3.61,0,0,1,4.27,1.17,6.24,6.24,0,0,1,1.05,4.56,25,25,0,0,1-1.25,4.63,7.19,7.19,0,0,0-.47,3.16,2.39,2.39,0,0,0,4.6.89,7.9,7.9,0,0,0,.85-3.07c.52-3.85,1-7.86-.12-11.58a13.71,13.71,0,0,0-9.41-9c-4.3-1.........完整代码请登录后点击上方下载按钮下载查看

网友评论0