2016-09-23 141 views
0

我嘗試了一些代碼使我的徽標閃爍使用CSS3。不幸的是結果並不好。看看我的代碼片段,我已經完成了。閃屏徽標上的閃屏

p/s:閃光燈的邊框使我的閃屏不太好。

我的預期輸出:

灼灼沿着標誌之舉。

/*Splash screen*/ 
 
body 
 
{ 
 
    background-color:#ccc; 
 
} 
 
.middle-screen 
 
{ 
 
    height: 100px; 
 
    /* margin-top: 31vh;*/ 
 
    width: 74%; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
} 
 

 
i.splash { 
 
    position: absolute; 
 
    opacity: 0; 
 
    top: 0; 
 
    left: 0; 
 
    background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* ff3.6+ */ 
 
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(255,255,255,1)), color-stop(0%, rgba(255,255,255,1)), color-stop(100%, rgba(255,255,255,0)), color-stop(100%, rgba(255,255,255,0))); /* safari4+,chrome */ 
 
    background:-webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* safari5.1+,chrome10+ */ 
 
    background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* opera 11.10+ */ 
 
    background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* ie10+ */ 
 
    background:radial-gradient(ellipse at center, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* w3c */ 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#FFFFFF',GradientType=0); /* ie6-9 */ 
 
    width: 20%; 
 
    height: 72px; 
 
    transform: skew(-10deg, 0deg); 
 
    -webkit-transform: skew(-10deg, 0deg); 
 
    -moz-transform: skew(-10deg, 0deg); 
 
    -ms-transform: skew(-10deg, 0deg); 
 
    -o-transform: skew(-10deg, 0deg); 
 
    animation: move 5s; 
 
    /*animation-iteration-count: infinite;*/ 
 
    animation-delay: 300ms; 
 
    -webkit-animation: move 5s; 
 
    /*-webkit-animation-iteration-count: infinite;*/ 
 
    -webkit-animation-delay: 300ms; 
 
    -moz-transform: skew(-10deg, 0deg); 
 
    -moz-animation: move 5s; 
 
    /*-moz-animation-iteration-count: infinite;*/ 
 
    -moz-animation-delay: 1s; 
 
    -ms-transform: skew(-10deg, 0deg); 
 
    -ms-animation: move 5s; 
 
    /*-ms-animation-iteration-count: infinite;*/ 
 
    -ms-animation-delay: 1s; 
 
    -o-transform: skew(-10deg, 0deg); 
 
    -o-animation: move 5s; 
 
    /*-o-animation-iteration-count: infinite;*/ 
 
    -o-animation-delay: 1s; 
 
    margin-top: 39vh; 
 
} 
 

 
/* */ 
 
@keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.8; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-webkit-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.2; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-moz-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 88%; 
 
    } 
 
} 
 
@-ms-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-o-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
}
<div class="bg-splash"> 
 
    <div class="middle-screen"> 
 
    <img width="100%" src="http://jiayuhk.com/sc/assets/img/sample/shortcode/logo/1.png" /> 
 
    <i class="splash"></i> 
 
    </div> 
 
</div>

回答

1

我從.middle-screen刪除margin-top: 31vh;。也許這就是你想要的東西:

/*Splash screen*/ 
 
body 
 
{ 
 
    background-color:#ccc; 
 
} 
 
.middle-screen 
 
{ 
 
    height: 100px; 
 
    width: 74%; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
} 
 

 
i.splash { 
 
    position: absolute; 
 
    opacity: 0; 
 
    top: 0; 
 
    left: 0; 
 
    background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* ff3.6+ */ 
 
    background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(255,255,255,1)), color-stop(0%, rgba(255,255,255,1)), color-stop(100%, rgba(255,255,255,0)), color-stop(100%, rgba(255,255,255,0))); /* safari4+,chrome */ 
 
    background:-webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* safari5.1+,chrome10+ */ 
 
    background: -o-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* opera 11.10+ */ 
 
    background: -ms-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* ie10+ */ 
 
    background:radial-gradient(ellipse at center, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%, rgba(255,255,255,0) 100%); /* w3c */ 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#FFFFFF',GradientType=0); /* ie6-9 */ 
 
    width: 20%; 
 
    height: 72px; 
 
    transform: skew(-10deg, 0deg); 
 
    -webkit-transform: skew(-10deg, 0deg); 
 
    -moz-transform: skew(-10deg, 0deg); 
 
    -ms-transform: skew(-10deg, 0deg); 
 
    -o-transform: skew(-10deg, 0deg); 
 
    animation: move 5s; 
 
    /*animation-iteration-count: infinite;*/ 
 
    animation-delay: 300ms; 
 
    -webkit-animation: move 5s; 
 
    /*-webkit-animation-iteration-count: infinite;*/ 
 
    -webkit-animation-delay: 300ms; 
 
    -moz-transform: skew(-10deg, 0deg); 
 
    -moz-animation: move 5s; 
 
    /*-moz-animation-iteration-count: infinite;*/ 
 
    -moz-animation-delay: 1s; 
 
    -ms-transform: skew(-10deg, 0deg); 
 
    -ms-animation: move 5s; 
 
    /*-ms-animation-iteration-count: infinite;*/ 
 
    -ms-animation-delay: 1s; 
 
    -o-transform: skew(-10deg, 0deg); 
 
    -o-animation: move 5s; 
 
    /*-o-animation-iteration-count: infinite;*/ 
 
    -o-animation-delay: 1s; 
 
    margin-top: 39vh; 
 
} 
 

 
/* */ 
 
@keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.8; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-webkit-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.2; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-moz-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 88%; 
 
    } 
 
} 
 
@-ms-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
} 
 
@-o-keyframes move { 
 
    0% { 
 
    left: 0; 
 
    opacity: 0; 
 
    } 
 
    5% { 
 
    opacity: 0.0; 
 
    } 
 
    48% { 
 
    opacity: 0.4; 
 
    } 
 
    80% { 
 
    opacity: 0.0; 
 
    } 
 
    100% { 
 
    left: 82%; 
 
    } 
 
}
<div class="bg-splash"> 
 
    <div class="middle-screen"> 
 
    <img width="100%" src="http://jiayuhk.com/sc/assets/img/sample/shortcode/logo/1.png" /> 
 
    <i class="splash"></i> 
 
    </div> 
 
</div>

+0

仍然不能滿足我的要求,如果你還可以刪除閃光燈的所有4邊的邊界,那麼它的更好。 – Nere

0

只要從.middle_screen刪除邊距,你應該是好去。