Sakura博客主题首页的波浪动画效果

发布于 2019-10-12  143 次阅读


CSS如下:

#banner_wave_1 {
    width: auto;
    height: 65px;
    background: url(https://cdn.qnight.ink/blogfile/wave1.png) repeat-x;
    _filter: alpha(opacity=80);
    position: absolute;
    bottom: 0;
    width: 400%;
    left: -236px;
    z-index: 5;
    opacity: 1;
    transiton-property: opacity,bottom;
    transition-duration: .4s,.4s;
    animation-name: move2;
    animation-duration: 240s;
    animation-fill-mode: backwards;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
#banner_wave_2 {
    width: auto;
    height: 80px;
    background: url(https://cdn.qnight.ink/blogfile/wave2.png) repeat-x;
    _filter: alpha(opacity=80);
    position: absolute;
    bottom: 0;
    width: 400%;
    left: 0;
    z-index: 4;
    opacity: 1;
    transiton-property: opacity,bottom;
    transition-duration: .4s,.4s;
    animation-name: move2;
    animation-duration: 160s;
    animation-fill-mode: backwards;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

//move1和move2只是方向不同,根据喜好自选即可。
//没做浏览器适配,具体哪些浏览器会生效未知,反正Chrome没什么问题。

@keyframes move1 {
  100%{
    background-position: 100% 0;
  }
}

@keyframes move2 {
  100%{
    background-position: -100% 0;
  }
}

波浪图片可以自己保存但是不要直接引用……叭,一分CDN流量一分钱啊TAT

两个DIV的穿插位置

在路径/wp-content/themes/Sakura/layouts下,打开imgbox.php。在下面所述位置插入。

……
<style>.header-info::before{display: none !important;opacity: 0 !important;}</style>
<div id="banner_wave_1"></div><div id="banner_wave_2"></div>    <!--两个DIV插在这。-->
<figure id="centerbg" class="centerbg">
<?php if ( !akina_option('focus_infos') ){ ?>
    <div class="focusinfo">
        <?php if (akina_option('focus_logo')):?>
……

注:本文转载自夜のDAILY


Never give up your dreams.