怎么表白女生做女朋友不会被拒绝
0
2023-05-24
序言:每当过节的时候,女朋友就抱怨我总是忘记给她买花,说程序不懂浪漫,这不我准备了几款爱心动画特效,打算当面向她表达一下。
寓意:告白无须多么华丽的语言,一颗颗小的爱心汇聚成一颗真心,让你的另一半感受到浓浓的爱意。
代码难度系数★★★
新建index.html,复制以下代码保存在浏览器中打开即可。
<metacharset="utf-8">canvas心 <style>html,body{height:100%;padding:0;margin:0;background:#000;}canvas{position:absolute;width:100%;height:100%;}</style><body><script>/**Settings*/varsettings={particles:{length:500,//maximumamountofparticlesduration:2,//particledurationinsecvelocity:100,//particlevelocityinpixels/seceffect:-0.75,//playwiththisforaniceeffectsize:30,//particlesizeinpixels},};/**RequestAnimationFramepolyfillbyErikM?ller*/(function(){varb=0;varc=["ms","moz","webkit","o"];for(vara=0;a =duration&&firstActive!=firstFree){firstActive++;if(firstActive==particles.length)firstActive=0;}};ParticlePool.prototype.draw=function(context,image){//drawactiveparticlesif(firstActive
寓意:将想说的话打开一颗颗的爱心气球上,随着气球不断的升空,让整个氛围可更加地缠绵,看到此处可以有感动的泪水。
代码难度系数★★★
新建index.html,复制以下代码保存在浏览器中打开即可。
<metacharset="utf-8">情人节快乐:) <style>canvas{position:absolute;top:0;left:0;}</style><body><script>varw=c.width=window.innerWidth,h=c.height=window.innerHeight,ctx=c.getContext('2d'),opts={phrases:["Don'tdie\nit'snothard","You'retheBest","Everyday,\nYou'rebeautiful","Everyoccasion,\nYou'reclever","AworldwithoutYou?\nNah","Keepkickingass","You'rebetterthanthem,\nwhoevertheyare","You'rejustamazing","Youare,\nthereforeIam","NothingbetterthanYou\ncouldhavehappenedtotheworld"],balloons:10,baseVelY:-1,addedVelY:-1,baseVelX:-.25,addedVelX:.5,baseSize:20,addedSize:10,baseSizeAdder:2,addedSizeAdder:2,baseIncrementer:.01,addedIncrementer:.03,baseHue:-10,addedHue:30,font:'15pxVerdana'},cycle=0,balloons=[];ctx.font=opts.font;functionBalloon(){this.reset();}Balloon.prototype.reset=function(){this.size=opts.baseSize+opts.addedSize*Math.random();this.sizeAdder=opts.baseSizeAdder+opts.addedSizeAdder*Math.random();this.incrementer=opts.baseIncrementer+opts.addedIncrementer*Math.random();this.tick=0;this.x=Math.random()*w;this.y=h+this.size;this.vx=opts.baseVelX+opts.addedVelX*Math.random();this.vy=opts.baseVelY+opts.addedVelY*Math.random();this.color='hsla(hue,70%,60%,.8)'.replace('hue',opts.baseHue+opts.addedHue*Math.random());this.phrase=opts.phrases[++cycle%opts.phrases.length].split('\n');this.lengths=[];for(vari=0;i
寓意:天空中下起了爱心雨,衬托的房间变得温暖,也让整个场景都变得温馨无比,想必此时可以有一个大大的拥抱。
代码难度系数★★★
代码有image、js和html,所以不好贴出来,有需要的朋友直接问我要吧。
总结:程序员的工作本身就很枯燥,特定找了几个好看的特效拿出来和大家分享,希望大家能够快乐每一天,上述代码亲测可用,欢迎点赞收藏。