基于CSS實現(xiàn)元素融合效果
發(fā)布時間:2023-02-14 14:40:19 作者:水星記_
我要評論

現(xiàn)如今網(wǎng)頁越來越趨近于動畫,相信大家平時瀏覽網(wǎng)頁或多或少都能看到一些動畫效果,今天我們來做一個有意思的動畫效果,通過 css3 實現(xiàn)元素融合效果,感興趣的朋友跟隨小編一起看看吧
前言
現(xiàn)如今網(wǎng)頁越來越趨近于動畫,相信大家平時瀏覽網(wǎng)頁或多或少都能看到一些動畫效果,今天我們來做一個有意思的動畫效果,通過 css3 實現(xiàn)元素融合效果,下面一起看看吧。
實現(xiàn)效果
完整源碼
<template> <div class="parentBox"> <div class="contantBox"></div> </div> </template> <style lang="less" scoped> .parentBox { height: 100%; background: rgb(31, 31, 31); padding: 100px; @keyframes filterBallMove { 50% { left: 140px; } } @keyframes filterBallMove2 { 50% { right: 140px; } } .contantBox { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 300px; height: 200px; filter: contrast(20); } .contantBox::before { content: ""; position: absolute; width: 120px; height: 120px; border-radius: 50%; background: olive; top: 40px; left: 80px; z-index: 2; filter: blur(6px); box-sizing: border-box; animation: filterBallMove 4s ease-out infinite; } .contantBox::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; background: green; top: 60px; right: 40px; z-index: 2; filter: blur(6px); animation: filterBallMove2 4s ease-out infinite; } } </style>
文字融合
實現(xiàn)效果
完整源碼
<template> <div class="parentBox"> <div class="contantBox"> <h1>hello Word!</h1> </div> </div> </template> <style lang="less" scoped> .parentBox { height: 100%; background: rgb(31, 31, 31); padding: 100px; .contantBox { width: 100%; height: 100%; position: relative; padding: 4em; filter: contrast(20); overflow: hidden; background: rgb(0, 0, 0); h1 { font-family: Righteous; color: white; font-size: 4rem; text-transform: uppercase; line-height: 1; animation: letterspacing 3s infinite alternate ease-in-out; display: block; position: absolute; left: 50%; top: 50%; transform: translate3d(-50%, -50%, 0); letter-spacing: -2.2rem; } } @keyframes letterspacing { 0% { letter-spacing: -2.4rem; filter: blur(0.3rem); } 50% { filter: blur(0.5rem); } 100% { letter-spacing: 0.5rem; filter: blur(0rem); color: #fff; } } } </style>
到此這篇關(guān)于基于CSS實現(xiàn)元素融合效果的文章就介紹到這了,更多相關(guān)css元素融合內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
- 在 CSS 中使用 mask 遮罩,一行代碼實現(xiàn)頭像與國旗的融合效果,那么,將一張國旗圖片與我們的頭像,快速得到想要的頭像,使用 CSS 如何簡單實現(xiàn)呢?感興趣的朋友跟隨小編一2021-10-21
- 這篇文章主要介紹了html+css實現(xiàn)充電水滴融合特效代碼,代碼簡單易懂,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2021-01-28
- 這篇文章主要介紹了純 CSS 實現(xiàn)蠟燭融化(水滴)的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一2020-11-11
- 這篇文章主要介紹了CSS實現(xiàn)兩個元素相融效果(粘滯效果),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)2020-10-12
CSS 多圖片融合背景定位的應(yīng)用于優(yōu)缺點分析
萬物都是相通的, 軟件和互聯(lián)網(wǎng)技術(shù)也一樣. 如果圖片作為網(wǎng)絡(luò)資源需要每個進(jìn)行連接來獲取, 那么 .js 文件和 .css 文件也是如此. 我們應(yīng)該將可能放在一起的資源綁起來. 這樣2009-12-17- 這篇文章將介紹如何使用CSS實現(xiàn)交融文字效果,這是一種獨特的標(biāo)題設(shè)計,可以增加頁面的視覺吸引力和用戶體驗。通過使用CSS的letter-spacing屬性,我們可以創(chuàng)建出字母之間交2023-04-27