r/matrix
@@ -1,51 +1,79 @@
/*
- * @title matrix
- * @javascript_url
- * @description my bookmarklet
+ * @title /r/matrix
+ * @description Neo's-eyes simulator
* @include http://*
- * @license MIT License
- * @require
+ * @include https://*
+ * @contributor jargonjustin https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
+ * @contributor NonNonHeinous, OptionalField, echeese and maschnitz
+ * @contributor yuta25 http://let.hatelabo.jp/yuta25/let/hJmeu-js5vps (Fork of)
+ * @license TBD (as-is); see the bottom
+ * @javascript_url
*/
-// original: https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/matrix_effect.html
+// remember '00s web
+// c.f.
+// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
+(() => {
+ 'use strict';
+
+ const canvas = document.createElement('canvas');
+ canvas.width = window.screen.width;
+ canvas.height = document.body.scrollHeight;
+
+ // canvas.style.height = `${document.body.scrollHeight}px`;
+ canvas.style.position = 'absolute';
+ canvas.style.top = canvas.style.left = '0';
+ canvas.style.zIndex = Number.MAX_SAFE_INTEGER || Number.MAX_VALUE;
-(function() {
- let q = document.createElement('canvas');
- document.body.appendChild(q);
- let s=window.screen;
- let w=q.width=s.width;
- let h=q.height=document.body.scrollHeight;
- let p=Array(256).join(1).split('');
- let c=q.getContext("2d");
- let m=Math;
- // q.style.height = `${document.body.scrollHeight}px`;
- q.style.position = 'absolute';
- q.style.top = q.style.left = '0';
- q.style.zIndex = '99999';
- let opacity = 0;
- let inc = true;
+ document.body.appendChild(canvas);
+
+ const ctx = canvas.getContext('2d');
+ let degree = 0;
+ let texts = Array(256).fill(1);
setInterval(() => {
- c.fillStyle="rgba(0,0,0,0.05)";
- c.fillRect(0,0,w,h);
- c.fillStyle="rgba(0,255,0,1)";
- if (inc) {
- opacity += 10;
- q.style.opacity = `${opacity/100}`;
- if (opacity >= 100) {
- inc = false;
- }
- } else {
- opacity -= 10;
- q.style.opacity = `${opacity/100}`;
- if (opacity <= 0) {
- inc = true;
- }
- }
- p=p.map((v,i) => {
- let r=m.random();
- c.fillText(String.fromCharCode(m.floor(2720+r*33)),i*10,v);
- v+=10;
- return v>768+r*1e4?0:v
- })
- },33);
-}())
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ ctx.fillStyle = 'rgba(0, 255, 0, 1)';
+ // opacity range: 0-1
+ // Trigonometry and Radian based algorithm
+ canvas.style.opacity = Math.abs(Math.cos(degree * Math.PI / 180));
+ degree += 10;
+
+ texts = texts.map((val, idx) => {
+ const rand = Math.random();
+ // XXX too much Magic Numbers
+ ctx.fillText(String.fromCharCode(Math.floor(2720 + rand * 33)), idx * 10, val);
+ val += 10;
+ return val > 768 + rand * 1e4 ? 0 : val;
+ });
+ }, 33);
+})();
+
+// # License/Fork Tree
+//
+// ## origin on /r/programming
+// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
+//
+// ## original code by /u/jargonjustin
+// Unknown (as-is)
+// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/c8x2fjx/
+//
+// ## merged by NonNonHeinous
+// Unknown (as-is)
+// /u/jargonjustin, /u/OptionalField, /u/echeese, and /u/maschnitz (and/or more redditors?)
+// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/c8x3vov/
+//
+// ## just a collect by MinhasKamal from merged code
+// Unknown (as-is)
+// https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/README.md
+// https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/matrix_effect.html
+//
+// ## pure js port and mod by yuta25
+// MIT License https://opensource.org/licenses/MIT
+// http://let.hatelabo.jp/yuta25/let/hJmeu-js5vps
+//
+// ## re-mod by noromanba the Genin translator
+// WTFPL (Do What the Fuck You Want to Public License)
+// http://www.wtfpl.net/about/
+// http://www.wtfpl.net/txt/copying/
+
/*
* @title /r/matrix
* @description Neo's-eyes simulator
* @include http://*
* @include https://*
* @contributor jargonjustin https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
* @contributor NonNonHeinous, OptionalField, echeese and maschnitz
* @contributor yuta25 http://let.hatelabo.jp/yuta25/let/hJmeu-js5vps (Fork of)
* @license TBD (as-is); see the bottom
* @javascript_url
*/
// remember '00s web
// c.f.
// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
(() => {
'use strict';
const canvas = document.createElement('canvas');
canvas.width = window.screen.width;
canvas.height = document.body.scrollHeight;
// canvas.style.height = `${document.body.scrollHeight}px`;
canvas.style.position = 'absolute';
canvas.style.top = canvas.style.left = '0';
canvas.style.zIndex = Number.MAX_SAFE_INTEGER || Number.MAX_VALUE;
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
let degree = 0;
let texts = Array(256).fill(1);
setInterval(() => {
ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'rgba(0, 255, 0, 1)';
// opacity range: 0-1
// Trigonometry and Radian based algorithm
canvas.style.opacity = Math.abs(Math.cos(degree * Math.PI / 180));
degree += 10;
texts = texts.map((val, idx) => {
const rand = Math.random();
// XXX too much Magic Numbers
ctx.fillText(String.fromCharCode(Math.floor(2720 + rand * 33)), idx * 10, val);
val += 10;
return val > 768 + rand * 1e4 ? 0 : val;
});
}, 33);
})();
// # License/Fork Tree
//
// ## origin on /r/programming
// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/
//
// ## original code by /u/jargonjustin
// Unknown (as-is)
// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/c8x2fjx/
//
// ## merged by NonNonHeinous
// Unknown (as-is)
// /u/jargonjustin, /u/OptionalField, /u/echeese, and /u/maschnitz (and/or more redditors?)
// https://www.reddit.com/r/programming/comments/1ag0c3/someone_posted_an_htmljavascript_implementation/c8x3vov/
//
// ## just a collect by MinhasKamal from merged code
// Unknown (as-is)
// https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/README.md
// https://github.com/MinhasKamal/CreepyCodeCollection/blob/master/matrix_effect.html
//
// ## pure js port and mod by yuta25
// MIT License https://opensource.org/licenses/MIT
// http://let.hatelabo.jp/yuta25/let/hJmeu-js5vps
//
// ## re-mod by noromanba the Genin translator
// WTFPL (Do What the Fuck You Want to Public License)
// http://www.wtfpl.net/about/
// http://www.wtfpl.net/txt/copying/
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。