gsap+split-type实现按钮悬浮文字上下交错分割动画效果代码

代码语言:html

所属分类:悬停

代码描述:gsap+split-type实现按钮悬浮文字上下交错分割动画效果代码

代码标签: gsap split-type 按钮 悬浮 文字 上下 交错 分割 动画

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

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

<head>
  <meta charset="UTF-8">

  
  
<style>
* {
  box-sizing: border-box;
}

body {
  padding: 0;
  margin: 0;
  font-size: 1rem;
  min-height: 100vh;
  font-family: system-ui;
}

main {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.button-text-wrapper {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  display: flex;
  position: relative;
  overflow: hidden;
}

a {
  padding: 0.8em 2em;
  font-size: 1.2rem;
  cursor: pointer;
  border: none;
  border-radius: 0.5em;
  text-transform: lowercase;
  color: white;
  transition: background 0.3s ease-out;
  background-color: #2c4bff;
}

.button-text {
  white-space: nowrap;
}

.button-text.is-2 {
  align-self: auto;
  position: absolute;
  inset: 0%;
}
</style>

  
  
</head>

<body translate="no">
  <main>
  <a hoverstagger="link" class="button" hoverstagger="text">
    <div class="button-text-wrapper">
      <span hoverstagger="text" class="button-text">fun animations</span>
      <span hoverstagger="text" class="button-text is-2">fun animations</span>
    </div>
  </a>
</main>
<script type="text/javascript".........完整代码请登录后点击上方下载按钮下载查看

网友评论0