Concept: I felt inspired by the generative text artworks we reviewed in our last class. I decided to construct the scene using repeated words, rather than the usual shapes or images.
Process: I really tried to simplify my task of creating this piece, as I think that my skills with JavaScript are quite limited. The challenging part for me was trying to understand how to map out/divide the canvas into regions for text. It’s not a shape with particular coordinates, and that is why it was a little hard for me. Here is an example from the code:
// sky
function drawSky() {
fill(100, 160, 255);
textSize(14);
for (let y = 0; y < height / 2; y += 20) {
for (let x = -50; x < width; x += 60) {
text("sky", x + offset % 60, y);
My code:
let offset = 0;
function setup() {
createCanvas(400, 400);
textFont('Arial');
}
function draw() {
background(255);
offset += 0.5;
drawSky();
drawSun();
drawBuildings(); // static buildings!!!!!
drawRoad();
drawCars();
}
// sky
function drawSky() {
fill(100, 160, 255);
textSize(14);
for (let y = 0; y < height / 2; y += 20) {
for (let x = -50; x < width; x += 60) {
text("sky", x + offset % 60, y);
}
}
}
// sun
function drawSun() {
fill(255, 180, 0);
textSize(16);
for (let y = 40; y < 120; y += 18) {
for (let x = 250; x < 350; x += 40) {
text("sun", x, y);
}
}
}
// bldngs
function drawBuildings() {
fill(80);
textSize(12);
for (let y = height / 2; y < height - 80; y += 18) {
for (let x = 0; x < width; x += 55) {
text("building", x, y);
}
}
}
// road
function drawRoad() {
fill(120);
textSize(14);
for (let y = height - 80; y < height; y += 20) {
for (let x = -40; x < width; x += 60) {
text("road", x - offset % 60, y);
}
}
}
//cars
function drawCars() {
textSize(16);
let colors = [
color(255, 0, 0), // red
color(255, 200, 0), // yellow
color(0, 180, 0) // green
];
let roadTop = height - 80;
for (let i = 0; i < 3; i++) {
fill(colors[i]);
let y = roadTop + 25 + i * 15;
let speed = 6 + i * 2; // FAST
let x = (frameCount * speed) % (width + 80) - 80;
text("car", x, y);
}
}
Reflection: I constantly mention this, but I feel that, due to my limited ability with JavaScript, I’m unable to create pieces that match my imagination, which is why I tend to stick to safer and simpler options for the sake of my sanity. I will try to do more elaborate artworks in the future and expand my coding skills.