gsap实现文字打字效果与充咖啡动画效果代码

代码语言:html

所属分类:动画

代码描述:gsap实现文字打字效果与充咖啡动画效果代码

代码标签: 打字 效果 咖啡 动画 效果

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

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

<head>

  <meta charset="UTF-8">
  

<link href="https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@500&display=swap" rel="stylesheet">
  
  
  
<style>
body {
  background-color: #232f3a;
  height: 100vh;
  display: grid;
  place-items: center;
}
body .draw-box {
  overflow: hidden;
  position: relative;
  margin-top: 60px;
  width: 335px;
}
body .draw-box .typewriter-effect {
  overflow: hidden;
  -webkit-animation: typingEffect 1.6s steps(22) forwards, blinkTextCursor 1s infinite;
          animation: typingEffect 1.6s steps(22) forwards, blinkTextCursor 1s infinite;
  width: 0;
  color: #e8e8e8;
  height: 30px;
  font-size: 34px;
  white-space: nowrap;
  vertical-align: middle;
  line-height: 0.9;
  font-family: "Barlow Semi Condensed", sans-serif;
}
@-webkit-keyframes typingEffect {
  from {
    width: 0;
  }
  to {
    width: 98%;
  }
}
@keyframes typingEffect {
  from {
    width: 0;
  }
  to {
    width: 98%;
  }
}
@-webkit-keyframes blinkTextCursor {
  from {
    border-right: 3px solid #f8f8f8;
  }
  to {
    border-right: transparent;
  }
}
@keyframes blinkTextCursor {
  from {
    border-right: 3px solid #f8f8f8;
  }
  to {
    border-right: transparent;
  }
}
body .draw-box svg {
  width: 93%;
  margin-top: 10px;
}
body .draw-box svg .stroke {
  fill: none;
  stroke: #e8e8e8;
  stroke-width: 0.8;
}
body .draw-box svg .coffeeColor {
  fill: #b59440;
}
body .draw-box svg .steamColor {
  fill: #ddd;
}
body .draw-box svg .ripple {
  transform: translate3d(-30%, 100%, 0);
}
</style>



</head>

<body>
  <div class="draw-box">
	<div class="typewriter-effect">TIME TO DRINK COFFEE?</d.........完整代码请登录后点击上方下载按钮下载查看

网友评论0