给个人博客加个过场小动画代码 [复制链接]

帖子链接已复制到剪贴板
丁真 (UID: 4838) 3月前
帖子已经有人评论啦,不支持删除!

242 3

看到漫川博客mancs.cn里有个加载动画不错,死皮赖脸下找站长要来了。按我自己的垃圾审美改了改,

演示https://www.naigou.cn 额外加了个文字放大的效果 添加到额外css即可

漫川博客源代码

body:after {
    content: " ";
    position: fixed;
    inset: 0;
    background-color: white;
    z-index: 999;
    background-image: url(https://ttimg.cn/logo1.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20%;
    animation: fadeOut 2s;
    animation-fill-mode: forwards;
    -webkit-transition: fadeOut 2s;
    transition: fadeOut 2s;
    pointer-events: none;
    background-color: #fff;
}
@keyframes fadeOut {
  50% {
    opacity: 1;
  }
 
  100% {
    opacity: 0;
  }
}

画蛇添足版

body:after {
    content: " ";
    position: fixed;
    inset: 0;
    background-color: white;
    z-index: 999;
    background-image: url(https://ttimg.cn/logo1.svg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20%;
    animation: fadeOut 3s forwards, scaleUp 3s forwards; 
    pointer-events: none;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes scaleUp {
  0% {
    background-size: 20%;
  }
  100% {
    background-size: 150%; 
  }
}
奶狗博客 naigou.cn
已有评论 (3)
提示:您必须 登录 才能查看此内容。
创建新帖
广告推广点击空位自助购买