We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi ! I have an issue trying to make my text scroll. So I instead I have been trying to make the process reload when the text hit the bottom of the page. I tried to make my own setup fonction, to loop, to redraw, to insert the code inside another one it works but I don't know how to make the draw fonction resart from the top of the screen.
Could you help me for either the first or the second, or both options ?
Thanks a lot !
PFont typo;
String house = "A HOUSE OF";
String using = "USING";
String inhabited = "INHABITED";
String [] of = {
"SEAWEED AND HEMP BRICKS", "VEGETABLE FIBERS PANEL"
};
String [] where = {
"IN A STANDARDIZED SUBDIVISION", "IN A OVERPOPULATED BUILDING",
};
String [] light = {
"STREETLIGHTS NIGHT AND DAY ", "NO LIGHT",
};
String [] who = {
"BY PEOPLE ALWAYS HAVE THEIR EYES ON THEIR SCREEN", "BY IDLERS WHO DO NOTHING"
};
float y;
void setup() {
size(793, 1122);
//fullScreen();
smooth();
frameRate(0.9);
background(255);
fill(50);
// typo = loadFont("Dot Matrix.vlw");
typo = createFont("Dot Matrix", 10);
textFont(typo, 15);
}
void draw() {
y = y + 110;
translate(0, y);
text(house, 60, -70);
text(using, 120, -23);
text(inhabited, 150, 0);
text( of[int(random(0, of.length))], 156, -70);
text( where[int(random(0, where.length))], 90, -47);
text( light[int(random(0, light.length))], 175, -23);
text(who[int(random(0, who.length))], 236, 0);
}
void keyPressed() {
saveFrame("HouseofDust-##.jpg");
}
Answers
I'm not sure if this is exactly what you wanted, but this is a sketch that scrolls automatically when the text reaches the line. It's also possible to scroll maually with the mouseWheel.
If this isn't exactly what you were looking for, then hopefully it gives you an idea of what you can do and what the mouseWheel function does and also other functions that exists that relates to text and displaying text.
Notice that when you add another line, the text jumps into position so the bottom (most recent) line of text is visible at the black line across the screen. I find that this is quite useful because then the new text is right there in front of you. Besides, as it is now, the text might be lost outside the screen because there is no limit to how far you can spin the wheel.
You could also limit the push variable so that you can't scroll more than 20 lines away from the text, but I'm a little unsure of how you could do that. You can probably figure it out if you really want to :)
hi ! Thank you so much for answering me and sorry for the late reply, so this is not exactly what I wanted because I need to respect a really strict page setting as for example to have a space each for lines and some other stuff that I am not sure to be able to setup with this code. Anyway I figured out another way that suits me but I have an another project with electronic pad and random words and I thinks this is going to be perfect for what I want to do :) ! thanks !