HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效

這篇文章主要介紹“HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效”,在日常操作中,相信很多人在HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習(xí)吧!

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比向陽網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式向陽網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋向陽地區(qū)。費(fèi)用合理售后完善,十載實(shí)體公司更值得信賴。

鼠標(biāo)滑過遮罩文字背景動(dòng)畫效果

第一種效果的最終效果如下,用鼠標(biāo)放上去看看:

Welcome to htmleaf.com

HTML結(jié)構(gòu)

Welcome to Codicode

CSS樣式

body

{

background-color:#fff;

}

#bkDiv

{

// The rainbow Css3 pattern

background: linear-gradient(0deg, transparent 0%, #31009c 10%, #000084 25%,#009cff 37%,#00bd00 50%,#fff700 62%,#ff6331 75%,#de0000 90%,transparent 100%);

background-color: #333;

background-size: 10px 125px;

background-repeat : repeat;

height : 100px;

width : 620px;

background-position:center -65px;

transition: background-position 1s;

}

#bkDiv:hover

{

// on Hover the background translates 65px down

background-position:center 0px;

}

#theText

{

font-family:Impact, Charcoal, sans-serif;

font-size:65px;

stroke:#000;

stroke-width:3px;

fill-opacity:0.5;

}

當(dāng)作為背景的div被鼠標(biāo)滑過時(shí),CSS3背景將產(chǎn)生過渡動(dòng)畫效果。當(dāng)鼠標(biāo)滑出時(shí),背景的原點(diǎn)位置將回到原來的位置上。這里設(shè)置過渡動(dòng)畫的時(shí)間為1秒鐘。

另外,文字有50%的透明度和3像素的描邊,使文字看起來更加好看。

遮罩文字背景持續(xù)動(dòng)畫效果

先來看一下第二種Disco效果的遮罩文字背景動(dòng)畫效果:

Night CLUB

第二個(gè)遮罩文字背景動(dòng)畫效果的HTML代碼和第一個(gè)例子是一樣的:

HTML結(jié)構(gòu)

Welcome to Codicode

CSS樣式

body

{

background-color:#fff;

}

#bkDiv

{

// Red dots Css3 pattern

background: linear-gradient(-45deg, #036 30%,transparent 45%,transparent 55%,#036 70%),

linear-gradient(45deg, #036 30%,transparent 45%,transparent 55%,#036 70%);

background-color: #f00;

background-size: 15px 15px;

background-position:0px 0px;

height:150px;

width:550px;

// Animating red dots (infinite loop)

animation: cAnim 1s linear 0s infinite;

}

@keyframes cAnim

{

100% {background-position:15px 0px;}

}

#theText

{

font-family:Impact, Charcoal, sans-serif;

font-size:120px;

stroke:#000;

stroke-width:5px;

fill-opacity:0.1;

stroke-opacity:1;

// Strobe light effect animation

animation: cAnim1 0.5s linear 0s infinite;

}

@keyframes cAnim1

{

100% {fill-opacity:0.9;stroke-opacity:0.5;}

}

在第二個(gè)例子中同時(shí)執(zhí)行了兩種動(dòng)畫,第一個(gè)動(dòng)畫是在背景上移動(dòng)小圓點(diǎn),第二個(gè)動(dòng)畫是在SVG文字的邊框執(zhí)行閃動(dòng)效果。

到此,關(guān)于“HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)砀鄬?shí)用的文章!

網(wǎng)站名稱:HTML5怎么實(shí)現(xiàn)動(dòng)態(tài)文字遮罩背景特效
轉(zhuǎn)載來源:http://muchs.cn/article22/gdigcc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、網(wǎng)站設(shè)計(jì)公司、微信公眾號(hào)、網(wǎng)站建設(shè)、定制開發(fā)、網(wǎng)站改版

廣告

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

商城網(wǎng)站建設(shè)