xxxxxxxxxx
76
var txt;
var lines = [
"It is a period of civil war.",
"The Siths Tie Fighters striking",
"from a big, floating, base, have won",
"their 1000th victory against",
"the goody good good Rebels.",
"",
"During the battle, Sith",
"spies stool secret",
"plans to the Rebel's plans",
"A boring sticksaber made of",
"sticks, the plan says it is",
"station with enough power to",
"fix an entire planet.",
"",
"but it was an boring stick",
"Darth",
"King walks to Kylo King",
"boring right",
"then on the news",
"her people and restore",
"freedom to the galaxy..... bluh bluh bluh",
];
var font;
var txtWidth;
function preload() {
font = loadFont(
"https://fonts.gstatic.com/s/newscycle/v14/CSR54z1Qlv-GDxkbKVQ_dFsvWNRevA.ttf"
);
}
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL);
textFont(font);
textSize(width * 0.04);
textAlign(LEFT, TOP);
fill(238, 213, 75);
txt = join(lines, "\n");
txtWidth = 0;
for (var i = 0; i < lines.length; i++) {
txtWidth = max(txtWidth, textWidth(lines[i]));
}
}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}
function draw() {
background(0);
rotateX(1.2);
text(txt, -txtWidth / 2, height / 2 - millis() / 30);
}
(function () {
var script = document.createElement("script");
script.onload = function () {
var stats = new Stats();
stats.domElement.style.cssText =
"position:fixed;left:0;top:0;z-index:10000";
document.body.appendChild(stats.domElement);
requestAnimationFrame(function loop() {
stats.update();
requestAnimationFrame(loop);
});
};
script.src = "//rawgit.com/mrdoob/stats.js/master/build/stats.min.js";
document.head.appendChild(script);
})();