CSS3 讓width隨方向變化

GIF.gif

利用這種特性可以做出下面這個動畫


GIF.gif

源碼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

   
    <style>
    .section6 {
    background: black;
    background-size: cover;
    height: 100vh;
}
.section6 .container{
    /*background: url("../img/1.png") no-repeat;*/
    background-size: 100%;
    height: 500px;
    position: relative;
}
.section6 .section-title {color: #fff;}
.section6 .line {
    background: #0075FF;
    height: 1px;
    transform-origin: left top;
    position: absolute;
    width: 0;
}
.section6 .line1 {
    top: 346px;
    left: 44px;
    transform: rotate(-21deg);
    animation: aline1 1s .5s forwards;
    /*width: 239px;*/
}
.section6 .line2 {
    top: 261px;
    left: 267px;
    animation: aline2 1s 1.5s forwards;
    /*width: 200px;*/
}
.section6 .line3 {
    /*width: 216px;*/
    top: 261px;
    left: 466px;
    transform: rotate(-2deg);
    animation: aline3 1s 2.5s forwards;
}
.section6 .line4 {
    top: 252px;
    /*width: 217px;*/
    left: 681px;
    transform: rotate(31deg);
    animation: aline4 1s 3.5s forwards;
}
.section6 .line5 {
    /*width: 240px;*/
    left: 868px;
    top: 366px;
    transform: rotate(-35deg);
    animation: aline5 1s 4.5s forwards;
}
.section6 .line6 {
    /*width: 227px;*/
    left: 1064px;
    top: 230px;
    transform: rotate(-125deg);
    animation: aline6 1s 5.5s forwards;
}
@keyframes textFadeIn {
    from {opacity: 0}
    to {opacity: 1}
}
@keyframes dshadow {
    from {box-shadow: none;}
    to {box-shadow:0 0 10px 5px rgba(0,117,255,1);}
}
/*線動畫*/
@keyframes aline1 {
    from {width: 0;}
    to {width: 239px;}
}
@keyframes aline2 {
    from {width: 0;}
    to {width: 200px;}
}
@keyframes aline3 {
    from {width: 0;}
    to {width: 216px;}
}
@keyframes aline4 {
    from {width: 0;}
    to {width: 217px;}
}
@keyframes aline5 {
    from {width: 0;}
    to {width: 240px;}
}
@keyframes aline6 {
    from {width: 0;}
    to {width: 227px;}
}
.section6 .dot {
    width: 10px;
    height: 10px;
    background: radial-gradient(circle,#cce4ff,#0075FF);
    border-radius: 50%;
    /*box-shadow: 0 0 10px 5px rgba(0,117,255,1);*/
    position: absolute;
}
.section6 .dot p {
    white-space: nowrap;
    text-align: center;
    position: absolute;
    left: 50%;
    top: 30px;
    color: #0075FF;
    transform: translateX(-50%);
    opacity: 0;
}
.section6 .dot1 {
    top: 341px;
    left: 40px;
    animation: dshadow 1s forwards;
}
.section6 .dot2 {
    left: 260px;
    top: 256px;
    animation: dshadow 1s 1s forwards;
}
.section6 .dot3 {
    left: 460px;
    top: 256px;
    animation: dshadow 1s 2s forwards;
}
.section6 .dot4 {
    left: 680px;
    top: 251px;
    animation: dshadow 1s 3s forwards;
}
.section6 .dot5 {
    left: 863px;
    top: 359px;
    animation: dshadow 1s 4s forwards;
}
.section6 .dot6 {
    right: 101px;
    top: 224px;
    animation: dshadow 1s 5s forwards;
}
.section6 .dot6 p { left: 280%; }
.section6 .dot7 {
    right: 230px;
    top: 39px;
    animation: dshadow 1s 6s forwards;
}
.section6 .dot7 p {left: -40px; top: -10px;}

.section6 .dot1 p {
    animation: textFadeIn 1s forwards;
}
.section6 .dot2 p {
    animation: textFadeIn 1s 1s forwards;
}
.section6 .dot3 p {
    animation: textFadeIn 1s 2s forwards;
}
.section6 .dot4 p {
    animation: textFadeIn 1s 3s forwards;
}
.section6 .dot5 p {
    animation: textFadeIn 1s 4s forwards;
}
.section6 .dot6 p {
    animation: textFadeIn 1s 5s forwards;
}
.section6 .dot7 p {
    animation: textFadeIn 1s 6s forwards;
}
.container {width: 1170px; margin: 0 auto;padding-top: 120px}

    </style>
</head>
<body data-spy="scroll" data-target="#nav">

<!-- Swiper -->
<div class="swiper-container">
    <div class="swiper-wrapper" id="swiper-wrapper">
       
        <div class="swiper-slide section6">
            <div class="container">
                <div class="line line1"></div>
                <div class="line line2"></div>
                <div class="line line3"></div>
                <div class="line line4"></div>
                <div class="line line5"></div>
                <div class="line line6"></div>
                <div class="dot dot1"><p>客戶第一<br>Customer first</p></div>
                <div class="dot dot2"><p>開放<br>Open</p></div>
                <div class="dot dot3"><p>坦誠<br>Frank and honest</p></div>
                <div class="dot dot4"><p>高效<br>High efficiency</p></div>
                <div class="dot dot5"><p>擔(dān)當(dāng)<br>Assume</p></div>
                <div class="dot dot6"><p>持續(xù)進(jìn)化<br>Continuous evolution</p></div>
                <div class="dot dot7"><p>奮斗<br>struggle</p></div>

            </div>
        </div>
    </div>


</div>

</body>
</html>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末透乾,一起剝皮案震驚了整個濱河市消略,隨后出現(xiàn)的幾起案子垦写,更是在濱河造成了極大的恐慌钦购,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,657評論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件都许,死亡現(xiàn)場離奇詭異稻薇,居然都是意外死亡,警方通過查閱死者的電腦和手機胶征,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,889評論 3 394
  • 文/潘曉璐 我一進(jìn)店門塞椎,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人睛低,你說我怎么就攤上這事案狠。” “怎么了钱雷?”我有些...
    開封第一講書人閱讀 164,057評論 0 354
  • 文/不壞的土叔 我叫張陵骂铁,是天一觀的道長。 經(jīng)常有香客問我罩抗,道長从铲,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,509評論 1 293
  • 正文 為了忘掉前任澄暮,我火速辦了婚禮,結(jié)果婚禮上阱扬,老公的妹妹穿的比我還像新娘泣懊。我一直安慰自己,他們只是感情好麻惶,可當(dāng)我...
    茶點故事閱讀 67,562評論 6 392
  • 文/花漫 我一把揭開白布馍刮。 她就那樣靜靜地躺著,像睡著了一般窃蹋。 火紅的嫁衣襯著肌膚如雪卡啰。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,443評論 1 302
  • 那天警没,我揣著相機與錄音匈辱,去河邊找鬼。 笑死杀迹,一個胖子當(dāng)著我的面吹牛亡脸,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 40,251評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼浅碾,長吁一口氣:“原來是場噩夢啊……” “哼大州!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起垂谢,我...
    開封第一講書人閱讀 39,129評論 0 276
  • 序言:老撾萬榮一對情侶失蹤厦画,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后滥朱,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體根暑,經(jīng)...
    沈念sama閱讀 45,561評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,779評論 3 335
  • 正文 我和宋清朗相戀三年焚虱,在試婚紗的時候發(fā)現(xiàn)自己被綠了购裙。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,902評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡鹃栽,死狀恐怖躏率,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情民鼓,我是刑警寧澤薇芝,帶...
    沈念sama閱讀 35,621評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站丰嘉,受9級特大地震影響夯到,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜饮亏,卻給世界環(huán)境...
    茶點故事閱讀 41,220評論 3 328
  • 文/蒙蒙 一耍贾、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧路幸,春花似錦荐开、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,838評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至砰识,卻和暖如春能扒,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背辫狼。 一陣腳步聲響...
    開封第一講書人閱讀 32,971評論 1 269
  • 我被黑心中介騙來泰國打工初斑, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人膨处。 一個月前我還...
    沈念sama閱讀 48,025評論 2 370
  • 正文 我出身青樓越平,卻偏偏與公主長得像频蛔,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子秦叛,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,843評論 2 354

推薦閱讀更多精彩內(nèi)容