Skip to content

Commit e25150d

Browse files
committed
Video to AA Frame Array
This commit switches from injecting a video, to using a 54 frame ASCII Rick Roll. Note that Mobile and Desktop versions contain two different AA Arrays due to resolution constrains.
1 parent 947ee6a commit e25150d

File tree

3 files changed

+3848
-41
lines changed

3 files changed

+3848
-41
lines changed

AALIB-GUIDE.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
First, we breakdown the video into frames.
2+
``` bash
3+
ffmpeg -i asd.mp4 -vf "crop=900:860" frame%04d.png
4+
```
5+
6+
Then we console log the arrays after all of the calculations have been done.
7+
8+
Note that you need to set the frame count in the for loop.
9+
``` html
10+
<script type="text/javascript">
11+
let rickrollpc = []
12+
let rickrollphone = []
13+
// Function to pad numbers with leading zeros
14+
function padNumber(num, length) {
15+
let str = num.toString();
16+
while (str.length < length) {
17+
str = '0' + str;
18+
}
19+
return str;
20+
}
21+
for (let i = 1; i <= 54; i++) {
22+
let frameNumber = padNumber(i, 4);
23+
let filename = `./videos/frame${frameNumber}.png`;
24+
aalib.read.image.fromURL(filename)
25+
.map(aalib.aa({ width: 90, height: 40}))
26+
.map(aalib.filter.inverse(true))
27+
.map(aalib.render.html({ background: "#fff", fontFamily: "Ubuntu Mono, monospace", charset: "$1234567890{;:}(){}#$&*_+=-" }))
28+
.do(function (el) {
29+
30+
rickrollpc[i-1] = el.innerText.split("\n");
31+
})
32+
.subscribe()
33+
aalib.read.image.fromURL(filename)
34+
.map(aalib.aa({ width: 40, height: 25}))
35+
.map(aalib.filter.inverse(true))
36+
.map(aalib.render.html({ background: "#fff", fontFamily: "Ubuntu Mono, monospace", charset: "$1234567890{;:}(){}#$&*_+=-" }))
37+
.do(function (el) {
38+
39+
rickrollphone[i-1] = el.innerText.split("\n");
40+
})
41+
.subscribe()
42+
}
43+
setInterval(() => {
44+
console.log('PC')
45+
console.log(rickrollpc)
46+
console.log('Phone')
47+
console.log(rickrollphone)
48+
},2500)
49+
</script>
50+
```
51+
Afterwards, paste the Pre-Rendered AA animations as an array in your code.

config/commands.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@ const whoisRoot = "Root Ventures is a San Francisco-based deep tech seed fund ma
22
const timeUnit = 1000; // useful for development, set to 10 to run faster, set to 1000 for production
33
let killed = false;
44

5+
function SpawnRickRollPointers() {
6+
function padNumber(num, length) {
7+
let str = num.toString();
8+
while (str.length < length) {
9+
str = '0' + str;
10+
}
11+
return str;
12+
}
13+
14+
const colSize = term.cols >= 40 ? 39 : 24
15+
16+
for(let i = 0; i <= colSize; i++) {
17+
term.stylePrint(`${colorText(`vsabnBRXofjub${padNumber(i,2)}`, "command")}`, false);
18+
}
19+
}
20+
521
const commands = {
622
help: function() {
723
const maxCmdLength = Math.max(...Object.keys(help).map(x => x.length));
@@ -92,14 +108,7 @@ const commands = {
92108
},
93109

94110
test: function() {
95-
// innerText HTMLElement pointer for the correct terminal line.
96-
// We use this line to replace it with a video element.
97-
term.stylePrint(`${colorText("nf134bf139b", "command")}`, false);
98-
99-
// Mass print of background lines to correctly represent the height of the video
100-
for(let i = 0; i < 41; i++) {
101-
term.stylePrint(`${colorText("dn19BRXub191", "command")}`, false);
102-
}
111+
SpawnRickRollPointers()
103112
},
104113

105114
email: function() {
@@ -249,14 +258,7 @@ const commands = {
249258
term.stylePrint(`No such file: ${filename}`);
250259
}
251260
if (filename == "id_rsa") {
252-
// innerText HTMLElement pointer for the correct terminal line.
253-
// We use this line to replace it with a video element.
254-
term.stylePrint(`${colorText("nf134bf139b", "command")}`, false);
255-
256-
// Mass print of background lines to correctly represent the height of the video
257-
for(let i = 0; i < 41; i++) {
258-
term.stylePrint(`${colorText("dn19BRXub191", "command")}`, false);
259-
}
261+
SpawnRickRollPointers()
260262
}
261263
},
262264

0 commit comments

Comments
 (0)