美文网首页
美观大气的纯JS题文章

美观大气的纯JS题文章

作者: ee515b3d083d | 来源:发表于2017-11-18 11:18 被阅读0次

美观大气的纯JS

美观大气的纯JS做出黑客帝国特效

var cav = document.getElementById('content');

var w = window.screen.width;

var h = window.screen.height;

var yPositions = Array(300).join(0).split('');

var ctx = cav.getContext('2d');

var draw = function(){

ctx.fillStyle = 'rgba(0,0,0,.05)';

ctx.fillRect(0,0,w,h);

ctx.fillStyle = 'green';

ctx.font = '20px';

yPositions.map(function(y,index){

text = String.fromCharCode(1e2+Math.random()*330);

x = index*10;

cav.getContext('2d').fillText(text,x,y);

if(y>Math.random()*1e4){

yPositions[index]=0;

}else{

yPositions[index]=y+10;

}

});

}

setInterval('draw()',30);

前端/JAVA/PHP学习交流群498854752,web前端的公益学习交流平台,保你快速入门,海量学习资料免费送,保你快速入门,每周定期有公开直播课,有业内大咖为你授业解惑,海量真实项目案例分享,从零到大神的成功之路,从你相信我开始!!!

相关文章

网友评论

      本文标题:美观大气的纯JS题文章

      本文链接:https://www.haomeiwen.com/subject/bbrevxtx.html