圣诞树生长动画效果代码

代码语言:html

所属分类:动画

代码描述:圣诞树生长动画效果代码

代码标签: 效果

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


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

<head>

  <meta charset="UTF-8">
  

  
  
  
<style>
.tree {
  height: 90vmin;
  width: 60vmin;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  background: hsl(var(--h, 343), var(--s, 100%), var(--l, 50%));
  position: absolute;
  margin: auto;
  mix-blend-mode: overlay;
  transform: scale(var(--scale, 1));
  transform-origin: var(--t-o-x) var(--t-o-y);
  opacity: 1;
}
.bauble {
  height: 5vmin;
  width: 5vmin;
  border-radius: 50%;
  background: hsl(var(--h, 343), var(--s, 100%), var(--l, 50%));
  position: absolute;
  margin: auto;
  mix-blend-mode: screen;
  transform: scale(var(--scale, 1)) translate(var(--tx, 0), var(--ty, 0));
  transform-origin: var(--t-o-x) var(--t-o-y);
  opacity: 1;
}
main {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  width: 100%;
  background: hsl(var(--hue, 233), 80%, var(--saturation, 82%));
  animation: saturate 10000ms infinite alternate ease-in-out; /*,
    hue 17890ms infinite alternate ease-in-out; */
}

@keyframes saturate {
  0%,
  20% {
    --saturation: 82%;
  }
  100% {
    --saturation: 12%;
  }
}
@keyframes hue {
  0%,
  20% {
    --hue: 233;
  }
  100% {
    --hue: 343;
  }
}

@property --saturation {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 82%;
}
@property --hue {
  syntax: "<number>";
  inherits: false;
  initial-value: 233;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

p {
  position: absolute;
  top: 0;
  color: #ffeedd;
  text-transform: uppercase;
  font-family: system-ui, sans-serif;
  letter-spacing: 0.5em;
  width: 100%;
  padding: 1rem;
  text-align: center;
}
.pressed p {
  opacity: 0;
  transition: opacity 3000ms ease-in;
}
</style>



</head>

<body >
  <main>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class="tree"></div>
  <div class.........完整代码请登录后点击上方下载按钮下载查看

网友评论0