【爱心飘落 特效——使用 Html + CSS + JS 等实现,附 源代码 + 特效】(1)

margin: 0;

}

html,body{

height: 100%;

}

body{

overflow: hidden;

background: url(‘images/2.jpg’) no-repeat center/cover;

}

.snowfall-flakes:before,.snowfall-flakes:after{

content: ‘’;

position: absolute;

width: 10px;

height: 16px;

border-radius: 10px 10px 0 0;

background-color: red;

}

.snowfall-flakes:before{

transform: rotate(-45deg);

}

.snowfall-flakes:after{

transform: translateX(4.3px) rotate(45deg);

}

snowfall.jquery.js

(function(){var lastTime=0;var vendors=[‘webkit’,‘moz’];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+‘RequestAnimationFrame’];window.cancelAnimationFrame=window[vendors[x]+‘CancelAnimationFrame’]||window[vendors[x]+‘CancelRequestAnimationFrame’];}

if(!window.requestAnimationFrame)

window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall);},timeToCall);lastTime=currTime+timeToCall;return id;};if(!window.cancelAnimationFrame)

window.cancelAnimationFrame=function(id){clearTimeout(id);};}());(function(KaTeX parse error: Expected '}', got 'EOF' at end of input: ){.snowfall=function(element,options){var defaults={flakeCount:35,flakeColor:‘transparent’,flakePosition:‘absolute’,flakeIndex:999999,minSize:1,maxSize:2,minSpeed:1,maxSpeed:5,round:false,shadow:false,collection:false,collectionHeight:40,deviceorientation:false},options= . e x t e n d ( d e f a u l t s , o p t i o n s ) , r a n d o m = f u n c t i o n r a n d o m ( m i n , m a x ) r e t u r n M a t h . r o u n d ( m i n + M a t h . r a n d o m ( ) ∗ ( m a x − m i n ) ) ; ; .extend(defaults,options),random=function random(min,max){return Math.round(min+Math.random()*(max-min));}; .extend(defaults,options),random=functionrandom(min,max)returnMath.round(min+Math.random()(maxmin));;(element).data(“snowfall”,this);function Flake(_x,_y,_size,_speed,_id){this.id=_id;this.x=_x;this.y=_y;this.size=_size;this.speed=_speed;this.step=0;this.stepSize=random(1,10)/100;if(options.collection){this.target=canvasCollection[random(0,canvasCollection.length-1)];}

var flakeMarkup=null;if(options.image){flakeMarkup=KaTeX parse error: Expected 'EOF', got '}' at position 70: …ptions.image;*/}̲else{flakeMarku…(document.createElement(“div”));flakeMarkup.css({‘background’:options.flakeColor});}

flakeMarkup.attr({‘class’:‘snowfall-flakes’,‘id’:‘flake-’+this.id}).css({‘width’:this.size,‘height’:this.size,‘position’:options.flakePosition,‘top’:this.y,‘left’:this.x,‘fontSize’:0,‘zIndex’:options.flakeIndex});if( ( e l e m e n t ) . g e t ( 0 ) . t a g N a m e = = = (element).get(0).tagName=== (element).get(0).tagName===(document).get(0).tagName){ ( ′ b o d y ′ ) . a p p e n d ( f l a k e M a r k u p ) ; e l e m e n t = ('body').append(flakeMarkup);element= (body).append(flakeMarkup);element=(‘body’);}else{$(element).append(flakeMarkup);}

this.element=document.getElementById(‘flake-’+this.id);this.update=function(){this.y+=this.speed;if(this.y>(elHeight)-(this.size+6)){this.reset();}

this.element.style.top=this.y+‘px’;this.element.style.left=this.x+‘px’;this.step+=this.stepSize;if(doRatio===false){this.x+=Math.cos(this.step);}else{this.x+=(doRatio+Math.cos(this.step));}

if(options.collection){if(this.x>this.target.x&&this.x<this.target.width+this.target.x&&this.y>this.target.y&&this.y<this.target.height+this.target.y){var ctx=this.target.element.getContext(“2d”),curX=this.x-this.target.x,curY=this.y-this.target.y,colData=this.target.colData;if(colData[parseInt(curX)][parseInt(curY+this.speed+this.size)]!==undefined||curY+this.speed+this.size>this.target.height){if(curY+this.speed+this.size>this.target.height){while(curY+this.speed+this.size>this.target.height&&this.speed>0){this.speed*=.5;}

ctx.fillStyle=“#fff”;if(colData[parseInt(curX)][parseInt(curY+this.speed+this.size)]==undefined){colData[parseInt(curX)][parseInt(curY+this.speed+this.size)]=1;ctx.fillRect(curX,(curY)+this.speed+this.size,this.size,this.size);}else{colData[parseInt(curX)][parseInt(curY+this.speed)]=1;ctx.fillRect(curX,curY+this.speed,this.size,this.size);}

this.reset();}else{this.speed=1;this.stepSize=0;if(parseInt(curX)+1<this.target.width&&colData[parseInt(curX)+1][parseInt(curY)+1]==undefined){this.x++;}else if(parseInt(curX)-1>0&&colData[parseInt(curX)-1][parseInt(curY)+1]==undefined){this.x–;}else{ctx.fillStyle=“#fff”;ctx.fillRect(curX,curY,this.size,this.size);colData[parseInt(curX)][parseInt(curY)]=1;this.reset();}}}}}

if(this.x>(elWidth)-widthOffset||this.x<widthOffset){this.reset();}}

this.reset=function(){this.y=0;this.x=random(widthOffset,elWidth-widthOffset);this.stepSize=random(1,10)/100;this.size=random((options.minSize100),(options.maxSize100))/100;this.speed=random(options.minSpeed,options.maxSpeed);}}//素材家园 - www.sucaijiayuan.com

var flakes=[],flakeId=0,i=0,elHeight= ( e l e m e n t ) . h e i g h t ( ) , e l W i d t h = (element).height(),elWidth= (element).height(),elWidth=(element).width(),widthOffset=0,snowTimeout=0;if(options.collection!==false){var testElem=document.createElement(‘canvas’);if(!!(testElem.getContext&&testElem.getContext(‘2d’))){var canvasCollection=[],elements=$(options.collection),collectionHeight=options.collectionHeight;for(var i=0;i<elements.length;i++){var bounds=elements[i].getBoundingClientRect(),canvas=document.createElement(‘canvas’),collisionData=[];if(bounds.top-collectionHeight>0){document.body.appendChild(canvas);canvas.style.position=options.flakePosition;canvas.height=collectionHeight;canvas.width=bounds.width;canvas.style.left=bounds.left+‘px’;canvas.style.top=bounds.top-collectionHeight+‘px’;for(var w=0;w<bounds.width;w++){collisionData[w]=[];}

canvasCollection.push({element:canvas,x:bounds.left,y:bounds.top-collectionHeight,width:bounds.width,height:collectionHeight,colData:collisionData});}}}else{options.collection=false;}}

if( ( e l e m e n t ) . g e t ( 0 ) . t a g N a m e = = = (element).get(0).tagName=== (element).get(0).tagName===(document).get(0).tagName){widthOffset=25;}

KaTeX parse error: Expected '}', got 'EOF' at end of input: …ion(){elHeight=(element)[0].clientHeight;elWidth=$(element)[0].offsetWidth;});for(i=0;i<options.flakeCount;i+=1){flakeId=flakes.length;flakes.push(new Flake(random(widthOffset,elWidth-widthOffset),random(0,elHeight),random((options.minSize100),(options.maxSize100))/100,random(options.minSpeed,options.maxSpeed),flakeId));}

if(options.round){$(‘.snowfall-flakes’).css({‘-moz-border-radius’:options.maxSize,‘-webkit-border-radius’:options.maxSize,‘border-radius’:options.maxSize});}

if(options.shadow){$(‘.snowfall-flakes’).css({‘-moz-box-shadow’:‘1px 1px 1px #555’,‘-webkit-box-shadow’:‘1px 1px 1px #555’,‘box-shadow’:‘1px 1px 1px #555’});}

最后

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长,自己不成体系的自学效果低效漫长且无助。

因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点!不论你是刚入门Android开发的新手,还是希望在技术上不断提升的资深开发者,这些资料都将为你打开新的学习之门!

如果你觉得这些内容对你有帮助,需要这份全套学习资料的朋友可以戳我获取!!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
,需要这份全套学习资料的朋友可以戳我获取!!**](https://bbs.csdn.net/topics/618191877)

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值