渐变动画效果

利用CSS背景渐变色,并设置比较大比例的背景,通过CSS动画控制背景位置移动以实现效果。
渐变动画效果.gif

  1. @keyframes fluxay {
  2. 0% {
  3. background-position: 0;
  4. }
  5. 50% {
  6. background-position: 100%;
  7. }
  8. 100% {
  9. background-position: 0;
  10. }
  11. }
  12. .fluxay-box {
  13. width: 400px;
  14. height: 200px;
  15. /* 根据需要设置颜色 */
  16. background-image: linear-gradient(120deg, #db73ec, #be8ef3, #5ab4f5, #73ecec, #73ecb4, #a7ec73, #ecdd73, #eca073, #ec7389);
  17. background-size: 800%;
  18. animation: fluxay 8s infinite;
  19. }

文字流光效果

Animate.css官网的标题文字颜色效果。
文字流光效果.gif

  1. @keyframes hue {
  2. from {
  3. filter: hue-rotate(0);
  4. }
  5. to {
  6. filter: hue-rotate(360deg);
  7. }
  8. }
  9. .text-hue {
  10. color: #f35626;
  11. background-color: coral;
  12. -webkit-background-clip: text;
  13. -webkit-text-fill-color: transparent;
  14. background-image: -webkit-linear-gradient(45deg, #f35626, #feab3a);
  15. animation: hue 12s infinite linear;
  16. }