yumijie 大佬有话说 :
如何做出这个博客的背景效果出来?
博客:https://c*n*blogs.com/huanglei559
去掉*
很喜欢他这个博客的背景效果,应该是js特效吧.有大神能做出来吗?
wweng 大佬有话说 :
var c = document.querySelector("#c");
var ctx = c.getContext("2d");
//making the canvas full screen
c.height = window.innerHeight;
c.width = window.innerWidth;
//chinese characters – taken from the unicode charset
var chinese = "0123456789qwertyuiopasdfghjklzxcvbnm,./;'[]QWERTYUIOP{}ASDFGHJHJKL:ZXCVBBNM<>?がガぎギぐグげゲごゴきゃキャきゅキュきょキョりゃリャゅリュりょリョ";
//converting the string into an array of single characters
chinese = chinese.split("");
var font_size = 10;
var columns = c.width / font_size; //number of columns for the rain
//an array of drops – one per column
var drops = [];
//x below is the x coordinate
//1 = y co-ordinate of the drop(same for every drop initially)
for (var x = 0; x < columns; x++)
drops = 1;
//drawing the characters
function draw() {
//Black BG for the canvas
//translucent BG to show trail
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, c.width, c.height);
ctx.fillStyle = "#0F0"; //green text
ctx.font = font_size + "px arial";
//looping over drops
for (var i = 0; i < drops.length; i++) {
//a random chinese character to print
var text = chinese;
//x = i*font_size, y = value of drops*font_size
ctx.fillText(text, i * font_size, drops * font_size);
//sending the drop back to the top randomly after it has crossed the screen
//adding a randomness to the reset to make the drops scattered on the Y axis
if (drops * font_size > c.height && Math.random() > 0.975)
drops = 0;
//incrementing Y coordinate
drops++;
}
}
setInterval(draw, 50);
一位不知名网友 大佬有话说 :
我觉得可以,啊
先容我水一发 大佬有话说 :
熟悉的感觉,好像是某个课程的源码,你百度搜搜黑客帝国 h5特效
身无分文的5毛钱 大佬有话说 :
canvas绘的
yumijie 大佬有话说 :
wweng 大佬有话说 : 2020-2-19 20:31
谢谢大佬,去试试;P