欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

純CSS如何實現(xiàn)接扎啤的特效-創(chuàng)新互聯(lián)

這期內(nèi)容當中小編將會給大家?guī)碛嘘P純CSS如何實現(xiàn)接扎啤的特效,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

為平陰等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及平陰網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為網(wǎng)站設計制作、網(wǎng)站設計、平陰網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!效果預覽

純CSS如何實現(xiàn)接扎啤的特效

源代碼下載

https://github.com/comehope/front-end-daily-challenges

代碼解讀

定義 dom,容器中包含一個表示酒桶的.keg元素和表示啤酒杯的.glass元素。酒桶有 2 個子元素,.handle表示把手,.pipe表示出水管,酒杯有 1 個表示啤酒的子元素.beer

<div class="container">
    <div class="keg">
        <span class="handle"></span>
        <span class="pipe"></span>
    </div>
    <div class="glass">
        <span class="beer"></span>
    </div>
</div>

居中顯示:

body {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    background: linear-gradient(
        lightslategray 300px,
        #333 300px
    );
}

定義容器尺寸和偽元素的共有屬性:

.container {
    width: 700px;
    height: 300px;
    position: relative;
}

.container *::before,
.container *::after {
    content: '';
    position: absolute;
}

畫出酒桶:

.keg {
    position: absolute;
    width: 90px;
    height: 200px;
    background: linear-gradient(
        to right,
        #777 70px,
        #555 70px
    );
    bottom: 0;
    left: 310px;
}

畫出出水管和它的支架:

.keg .pipe {
    position: absolute;
    width: 10px;
    height: 40px;
    background-color: #ccc;
    top: 33px;
    left: 10px;
}

.keg .pipe::before {
    width: 40px;
    height: 20px;
    background: 
        radial-gradient(
            circle at 10px 10px,
            #eee 7px,
            #ccc 7px, #ccc 10px,
            transparent 10px
        ),
        linear-gradient(
            #ccc 50%,
            #999 50%
        );
    border-radius: 10px;
    top: -2px;
    left: -5px;
}

畫出把手:

.keg .handle {
    position: absolute;
    border-style: solid;
    border-width: 50px 10px 0 10px;
    border-color: black transparent transparent transparent;
    top: -10px;
    left: 5px;
}

.keg .handle::before {
    width: 20px;
    height: 10px;
    background-color: #ccc;
    top: -60px;
    left: -10px;
    border-radius: 5px 5px 0 0;
}

.keg .handle::after {
    width: 10px;
    height: 20px;
    background-color: #ccc;
    top: -20px;
    left: -5px;
}

畫出酒杯:

.glass {
    position: absolute;
    width: 70px;
    height: 100px;
    color: rgba(255, 255, 255, 0.3);
    background-color: currentColor;
    bottom: 0;
    left: 300px;
    border-radius: 5px;
}

.glass::before {
    width: 50px;
    height: 40px;
    border: 10px solid;
    top: 20px;
    right: -20px;
    border-radius: 0 40% 40% 0;
    clip-path: inset(0 0 0 72%);
}

畫出杯中的啤酒和泡沫:

.beer {
    position: absolute;
    width: 60px;
    height: 80px;
    background-color: rgba(255, 206, 84, 0.8);
    bottom: 15px;
    left: 5px;
    border-radius: 0 0 5px 5px;
    border-top: solid rgba(255, 206, 84, 0.8);
}

.beer::before {
    width: inherit;
    height: 15px;
    background-color: #eee;
    top: -15px;
    border-radius: 5px 5px 0 0;
}

接下來制作動畫。

增加酒杯把手被壓下的動畫效果:

.keg .handle {
    transform-origin: center 50px;
    animation: handle 5s infinite;
}

@keyframes handle {
    10%, 60% {
        transform: rotate(0deg);
    }

    20%, 50% {
        transform: rotate(-90deg);
    }
}

增加啤酒被斟滿的動畫效果:

.beer {
    animation: fillup 5s infinite;
}

@keyframes fillup {
    0%, 20% {
        height: 0px;
        border-width: 0px;
    }

    40% {
        height: 40px;
    }

    80%, 100% {
        height: 80px;
        border-width: 5px;
    }
}

增加啤酒泡沫泛起的動畫效果:

.beer::before {
    animation: 
        wave 0.5s infinite alternate,
        fillup-foam 5s linear infinite;
}

@keyframes fillup-foam {
    0%, 20% {
        top: 0;
        height: 0;
    }

    60%, 100% {
        top: -15px;
        height: 15px;
    }
}

@keyframes wave {
    from {
        transform: skewY(-3deg);
    }

    to {
        transform: skewY(3deg);
    }
}

增加啤酒從出水口流出的效果:

.keg .pipe::after {
    width: 10px;
    background-color: rgba(255, 206, 84, 0.5);
    animation: flow 5s infinite;
}

@keyframes flow {
    0%, 15% {
        top: 40px;
        height: 0;
    }

    20% {
        height: 115px;
    }

    40% {
        height: 75px;
    }

    55% {
        top: 40px;
        height: 50px;
    }

    60%, 100% {
        top: 80px;
        height: 0;
    }
}

最后,增加酒杯滑動的效果:

.glass {
    animation: slide 5s ease infinite;
}

@keyframes slide {
    0% {
        left: 0;
        filter: opacity(0);
    }

    20%, 80% {
        left: 300px;
        filter: opacity(1);
    }

    100% {
        left: 600px;
        filter: opacity(0);
    }
}

上述就是小編為大家分享的純CSS如何實現(xiàn)接扎啤的特效了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道。

新聞名稱:純CSS如何實現(xiàn)接扎啤的特效-創(chuàng)新互聯(lián)
文章來源:http://www.aaarwkj.com/article18/pjedp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供虛擬主機、網(wǎng)站內(nèi)鏈、外貿(mào)建站、網(wǎng)站設計建站公司、品牌網(wǎng)站設計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設
亚洲欧美日韩颜射极品| 国产又粗又长又猛又爽视频| 91美女人妻精品久久| 日韩欧美啪啪一区二区| 国产一区二区爽爽爽视频| 人妻av天堂综合一区| 亚洲一区精品中文字幕| 亚洲乱码一区二区在线| 在线不卡日本v二区到六区| 熟妇人妻精品一区二区三区颏| 欧美日韩亚洲人人夜夜澡| 亚洲欧美激情啪啪啪| 亚洲欧美精品专区久久| 成人午夜激情福利动态| 日韩商清av毛片网站| 又黄又爽区一区二区三| 青青草免费公开视频久久| 国产午夜三级视频在线观看 | 日本少妇人妻一区二区| 成人午夜欧美熟妇小视频| 麻豆国产av巨做国产剧情| 亚洲中文字幕女同系列av专区| 国产精品一区二区在线观看| 蜜桃一区二区三区免费| 少妇午夜福利一区二区| 日本激情精品在线观看| 成人性生活黄色三级视频| 日韩成人午夜视频在线| 很黄很刺激的视频中文字幕| 国产一区丝袜高跟在线| 欧美日韩国产精品久久乐播| 日韩欧美国产精品自拍| 国产伦人偷精品免费视频| 日韩欧美一区二区大片| 国产亚洲欧美日韩网站| 激情啪啪啪的免费网站| 日韩黄片一区二区三区| 一区二区三区欧美日韩在线 | 国产又粗又长又大无遮挡| 日本激情精品在线观看| 在线国产一区二区不卡|