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".........完整代码请登录后点击上方下载按钮下载查看

网友评论0