Newbie - connecting txt file to this code

hi all,

i am extremely new to processing, as of a few hours. perhaps i’m jumping too quickly and trying to do something more complex without know the basics but I have been messing around with the code below. And what I want to do is use a txt file with about 121 sentences of different definitions of “architecture” as the input for this visualization. I’ve tried a few ways to incorporate loadStrings without any luck… any advice on how to incorporate it into this existing code?

Thank you in advance!

public void setup() {
  size(3000, 2000, P2D);
public void draw() {    
  for (int i = 0; i < 1000; i++) {
    float x = random(width);
    float y = random(height);
    text("WHAT IS ARCHITECTURE?", x, y);
    text("Architecture is definitely a political act. - Peter Eisenman", x, y);
  if (frameCount % 10 == 0) println(frameRate);
1 Like

loadStrings fills an array (which is a list)

declare list before setup()

String[] list1=loadStrings…

There is a tutorial on arrays but you want

text(list1[int(random(list1.length))], …

1 Like

This will give you a flickering text so you can reduce frameRate OR store the index of the array (the int… part) in an int variable and also x,y Position and Update those 3 when frameCount is % 110 ==0 or so


Welcome to the community. :slight_smile:
You can format your code by :

  • Pressing Ctrl+T in the Processing IDE code editor.
  • Using the button </> in the message editor on this forum.