“You can make anything by writing” – C. S. Lewis
Concept:
I’ve been watching a few of Patt Vira’s videos on coding and one of them about generative text jumped out to me. In this video she made the text rotate in a interesting pattern. So I followed along the video and decided to try and maybe extended it a little bit so it’s a bit more unique. I also will say I’m still a bit new to the use of many of the JS functions and syntax, I’d like to hopefully revisit this in the future. But I’ll save it for the reflection.
I noticed a few things I could improve her code on, such as giving it different fonts. It was a bit stale if only one font was used so I thought maybe we can make it so when the user clicks, the fonts change. Also it was a bit bland seeing the hello text, so why not give the user the option to change around the text. Below is the final product.
How it’s made:
So the code is done with points, where the points are displayed based on the text’s poistion. Then lines are drawn to give that 3D effect of the code. Now this code utilizes the angles, and degrees which I will be honest, I struggle to understand as they were quite, finiky to say the least.
But then the text itself is displayed on the screen, in the rotational motion and in 3D. Again, learning this was quite a challenge but it was interesting nonetheless.
Highlighted bit of Code I’m proud of:
I decided to make it so there are different fonts used when the user clicks the screen.
function mousePressed() {
if (mouseY > 50) {
currentFontIndex = (currentFontIndex + 1) % fonts.length;
font = fonts[currentFontIndex];
updatePoints();
}
}
This function above cycles through a list of fonts and goes to the next font in the list. Based on the font, it gives off a different design, ranging in boldness and style. It was a good amount of fun to make but I will say I struggled here a little as initially I thought I could make a list using the loadFont function. But then after a bit more thinking, it is better to dynamically change the font type, using a different variable for a list. So I’ve made a fontList variable which houses the many fonts I’ve added to the file
let fontPaths = [ "fonts/GoogleSans_17pt-Regular.ttf", "fonts/Dosis-Regular.ttf", "fonts/ArchivoBlack-Regular.ttf", "fonts/PlaywriteNZBasic-Regular.ttf", "fonts/Bungee-Regular.ttf" ];
Reflection
I will say, I wish I could do more with this code. Obviously time constraints and many assignments coming up did hinder the overall product but I feel like some ways I can expand on it is by making different designs of the typography. Or even, finally figuring out how to make the text spin in different directions. However I feel confident in what I learned so far through this assignment so hopefully I can use this to expand on it for the midterm project.