跳至主要內容
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?

4563博客

全新的繁體中文 WordPress 網站
  • 首頁
  • 如何做出这个博客的背景效果出来?
未分類
19 2 月 2020

如何做出这个博客的背景效果出来?

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

文章導覽

上一篇文章
下一篇文章

AD

其他操作

  • 登入
  • 訂閱網站內容的資訊提供
  • 訂閱留言的資訊提供
  • WordPress.org 台灣繁體中文

51la

4563博客

全新的繁體中文 WordPress 網站
返回頂端
本站採用 WordPress 建置 | 佈景主題採用 GretaThemes 所設計的 Memory
4563博客
  • Hostloc 空間訪問刷分
  • 售賣場
  • 廣告位
  • 賣站?
在這裡新增小工具