📜  GlassmorphismUI 动画(1)

📅  最后修改于: 2023-12-03 15:00:59.213000             🧑  作者: Mango

GlassmorphismUI 动画

简介

GlassmorphismUI 是一种流行的 UI 设计风格,它最早于 2020 年开始出现,并迅速流行起来。这种风格基于半透明虚化和高光效果,使用扁平化设计元素、独特的图标和流畅的动画效果,使用户界面具有现代感和科技感。

动画效果

下面是几个基于 GlassmorphismUI 风格的常见动画效果:

Hover 效果
<div class="card">
  <h2>Card Title</h2>
  <p>Card Description</p>
</div>
.card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 200px;
  width: 300px;
  transition: transform 0.3s ease;
  cursor: pointer;
  &:hover {
    transform: translateY(-10px);
  }
  h2,
  p {
    color: white;
    text-align: center;    
  }
}
Modal 效果
<div class="modal">
  <div class="modal-header">
    <h2>Modal title</h2>
  </div>
  <div class="modal-body">
    <p>Modal content</p>
  </div>
</div>
.modal {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  &.active {
    opacity: 1;
    pointer-events: auto;
  }
  .modal-header,
  .modal-body {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
  }
  .modal-header h2 {
    margin: 0;
  }
}
Button 效果
<button class="glass-button">Button</button>
.glass-button {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 20px;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 10px 20px;
  transition: background 0.3s ease;
  &:hover {
    background: rgba(255, 255, 255, 0.2);
  }
}
总结

GlassmorphismUI 风格的动画效果具有现代感和科技感,能够为用户界面增添活力和舒适感。随着 UI 设计风格的日新月异,GlassmorphismUI 风格也将继续发展和演进。