let myFont, mySource, tS;
const languageWords = ["let", "const", "function", "for", "of"];
myFont = loadFont('SourceCodePro-VariableFont_wght.ttf');
mySource = loadStrings('SourceCode.js');
createCanvas(windowWidth, windowHeight, WEBGL);
drawSource(-width, -height/2, 0.1, 0, 0.2)
drawSource(0, 0, frameCount / 100, frameCount / 123, 0)
drawSource(- width / 3, -height, 0, 0, sin(frameCount * 0.1))
drawSource(- width / 3, -height, sin(sin(frameCount * 0.1)), 0, 0.1)
function drawSource(ix, iy, rx, ry, rz) {
for (let i = 0; i < 200; i+= 10) {
stroke(80, 80, 20, 50-i*0.25);
line(i, -height, i, height)
stroke(60, 80, 20, 50-i*0.25);
line(40 * tS - i, -height, 40 * tS - i, height)
let y = (-frameCount * 2.5) % (mySource.length * 1.2 * tS);
for (let line of mySource) {
line = line.replace("\t", " ");
const words = line.split(" ");
for (let word of words) {
const bbox = myFont.textBounds(word, x, y, tS);
const wordLen = word.length === 0 ? tS : bbox.w;
fill(10 + 30 * noise(x * 0.1, y * 0.1), 75, 75);
if (languageWords.includes(word)) fill("blue")
function windowResized() {
function mouseClicked() {
if (mouseButton === LEFT) setup();