CSS實(shí)現(xiàn)鼠標(biāo)懸浮動畫特效

最近發(fā)現(xiàn)css動畫真是只有你想不到,沒有她做不到,有些效果調(diào)好了做出來是真的好看。
1.第一個動畫:
這個動畫看起來還是很舒適的。 下面是這個的dom結(jié)構(gòu)以及樣式
<template> <div class="middle"> <div class="box"> <img src="../../assets/img/img-2.jpg"> <div class="box-content"> <h3 class="title">Williamson</h3> <span class="post">Web designer</span> <div class="icon"> <i class="iconfont iconfangdajing"></i> </div> </div> </div> </div> </template> <style scoped lang='scss' src="./index.scss"></style>
.box{ height: 320px; width: 440px; overflow: hidden; position: relative; z-index:1; transition: all .5s; img{ transition: all .5s ease; } .title{ color: #1e272e; font-size: 23px; font-weight: 700; text-transform: uppercase; margin: 0 0 3px 0; } .post{ font-size: 16px; text-transform: capitalize; display: block; float: right; margin-top: 8px; margin-right: 2px; } .box-content{ height: 100px; width: auto; position: absolute; z-index: 999; top: 30%; right: -150%; transition: all 0.5s; .icon{ display: inline-block; width: 28px; height: 28px; border-radius: 50%; background-color: #1e272e; position:absolute; top:-3px; right: -40px; transition: all .3s; i{ position: absolute; top: 7px; left: 7px; clear: both; font-size: 15px; color: #fff; } &:hover{ background-color: #fff; border-radius: 10%; box-shadow: 0 0 5px #1e272e inset; i{ color: #1e272e; } } } } &:hover{ box-shadow: 1px 2px 10px #999; img{ transform: scale(1.2) } .box-content{ right:18% } } } .box:before,.box:after{ content:""; background:radial-gradient(circle at 23% 70%,rgba(255,255,255,0.8),#fff 30%); width: 150%; height: 150%; opacity: 0; transform: rotate(45deg); position: absolute; top: -10.5%; right: -168%; z-index: 1; transition: all 0.35s; } .box:before{ top: -188%; left: -100%; } .box:hover:before{ background-color: rgba(255,255,255,0.5); width: 65%; height: 65%; right: auto; left: -15%; top: -43%; opacity: 0.5; } .box:hover:after{ top: -11.2%; right: -90.3%; opacity: 0.9; }
這個就是類似于兩個長方形在外面等著,等鼠標(biāo)hover
到圖片上以后再進(jìn)來。就像:
兩個長方形合并起來,配合overflow:hidden
就可以實(shí)現(xiàn)啦,是不是很簡單
2. 第二個動畫:
是不是感覺很高大上! 其實(shí)就是rotate
外面邊框而已啦! 當(dāng)邊框設(shè)置了border-radius: 50%;
以后,沒有邊框的一邊就會變成虛線哦~不要以為是canvas
啦,這樣也可以簡單實(shí)現(xiàn)! 下面是代碼部分~
<div class="items animated fadeInUpBig"> <div class="item" @mouseenter="hoverWord(1)" @mouseleave="hoverWordLeave(1)"> <div class="item-content"> <img src="../../assets/img/img-2.jpg" alt="" > <div class="word">{{word.word1}}</div> </div> </div> </div>
.items { display: flex; width: 80vw; margin-left: 10vw; .item{ width: 210px; height: 210px; border-radius: 50%; margin-top: 20vh; margin: 0 auto; .out-circle{ width: 210px; height: 210px; border: 1px solid #fff; border-left: 0; border-radius: 50%; position: relative; transition: all .45s linear; &:hover{ transform: rotate(180deg); } } .out-circle:before{ content: ""; width: 6.5px; height: 6.5px; border-radius: 50%; position: absolute; top: 27px; left: 27px; background-color: #fff; } &:hover{ .out-circle{ transform: rotate(180deg); } .item-content { img{ transform: scale(1.2); } .word{ font-size: 14px; } } } .item-content{ width: 162px; height: 162px; border-radius: 50%; overflow: hidden; position: relative; top: -186px; left: 24px; img{ width: 100%; height: 100%; border-radius: 50%; position: relative; //filter:blur(1px); filter: brightness(50%); transition: all .35s ease-in-out; } .word{ height: 40px; width: 145px; font-size: 22px; line-height: 38px; font-weight: 700; color: #fff; text-align: center; position: relative; top: -100px; left: 8px; border-top: 1px solid #fff;; border-bottom: 1px solid #fff; cursor: pointer; } } }
改字的地方用到了js,可以自己添加。
到此這篇關(guān)于CSS實(shí)現(xiàn)鼠標(biāo)懸浮動畫特效的文章就介紹到這了,更多相關(guān)CSS鼠標(biāo)懸浮動畫內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
- 這篇文章主要介紹了使用CSS實(shí)現(xiàn)按鈕邊緣跑馬燈動畫,技術(shù)上只使用了css+html,還是非常容易學(xué)習(xí)的,文中提供了詳細(xì)的代碼,需要的朋友可以參考下2023-04-28
- 這篇文章主要介紹了使用css實(shí)現(xiàn)水波加載動畫效果,技術(shù)上只用到了css+html,還是非常容易學(xué)習(xí)的,做出來的效果也很不錯,需要的朋友可以參考下2023-04-23
- 本文主要介紹了純CSS實(shí)現(xiàn)了下劃線的交互動畫效果,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)2023-03-06
基于css實(shí)現(xiàn)炫酷按鈕動畫效果案例代碼
按鈕在開發(fā)中使用的頻率非常的高,ui 框架中的按鈕組件也都是層出不窮,今天教大家僅用 css 實(shí)現(xiàn)一些非常炫酷的按鈕效果,感興趣的朋友跟隨小編一起學(xué)習(xí)吧2023-02-28css 動畫實(shí)現(xiàn)節(jié)流的示例代碼
節(jié)流指的避免過于頻繁的執(zhí)行一個函數(shù),基本上是通過js去控制節(jié)流問題,其實(shí)css也能做到節(jié)流,本文給大家講解css 動畫實(shí)現(xiàn)節(jié)流,感興趣的朋友一起看看吧2023-02-17- 本文主要介紹了利用css動畫實(shí)現(xiàn)節(jié)流,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-01-04
CSS動畫實(shí)現(xiàn)跳動的足球(瘋狂世界杯)
2022卡塔爾世界杯正在如火如荼的進(jìn)行之中,作為“諸神的黃昏”,本屆世界杯備受矚目,足壇巔峰老將c羅,梅西,內(nèi)馬爾也將隨本次世界杯退役,一代人的青春到此結(jié)束!本篇我2023-01-04CSS使用SVG實(shí)現(xiàn)動態(tài)分布的圓環(huán)發(fā)散路徑動畫
這篇文章主要介紹了CSS使用SVG實(shí)現(xiàn)動態(tài)分布的圓環(huán)發(fā)散路徑動畫,第一時間看到這個需求想到的就是 SVG 或者 Canvas,但是由于開發(fā)時可能還需要插入其他元素,所以這里還是希2022-10-27使用 CSS 構(gòu)建強(qiáng)大且酷炫的粒子動畫效果
粒子動畫就是頁面上存在大量的粒子構(gòu)建而成的動畫。傳統(tǒng)的粒子動畫主要由 Canvas、WebGL 實(shí)現(xiàn),接下來通過本文給大家介紹使用 CSS 構(gòu)建強(qiáng)大且酷炫的粒子動畫效果,感興趣的2022-08-09- 本文主要介紹了純CSS打字動畫的實(shí)現(xiàn)示例,逐個顯示一段文本中的字符,模擬出一種打字的效果,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價2022-07-25