Probably don't have to mention this, but I'm really new to processing and quite struggling with it.
I am trying to create a text to stand on a poster/page. But I also want it to break at the end of the text frame (and not care about where the end of a word might be). (i.e. I want the text to automaticly hyphenate (but not use an hyphen-symbol)
This is the code I am using now for it, but this doesn't have anything about the text breaking in it.
String title= "BRAUN TUBE JAZZ BAND" ;
textFont (font2,190);
fill (255);
textLeading (190);
text (title, 50, height/11, width-50, height);
This code only breaks the words if they are too long to fit on one line. I thought it might be a good solution to rip the string apart and create different letters, like this. But I don't know what to do after the line hits the end of the text frame (at width-50). So Right now, the text just runs of the page.
int x = 100;
for (int i = 0; i < title.length(); i++) {
text(titel.charAt(i),x,height/2);
x += 100;
}
So right now I am just kind of guessing what could be a way to solve it, but things I've tried (like textWidth) are not really working out.
I also thought of adding a space between every letter in the String, so that I could use some sort of wordspacing to make it look like words without spaces in between, but I cannot find a way to apply wordspacing, letterspacing or textspacing.
If anyone knows a solution to this, would be really cool. If you need a better description of my problem, feel free to tell me!
Hi, I recently picked up processing. For a test I am doing, I wanted to create an object scale proportionally, but start growing faster after a certain point. I wanted to do it this way, but it doesn't. I get an error saying: "Cannot find Anyting named "p" "
Here's the code:
float d = 61.5;
if (d<61){ float p= (100- (d/1.2)); }
else {float p= (50- ((d-60)*0.0138)); }
float size1 = (height/100*p);
fill (255,0,255);
ellipse (width/2, height/2, size1, size1);
Anyone knows where I'm making a mistake? Is it possible to combine if/else and a float-value?
There's something I want to do, but don't think it's possible, can someone please give me a hand?
I am creating a pdf file, with one or two images and a square. I want to have some transparency in the images and then save this to pdf. So far I have not found a way to do this.
I am really new to processing and quite bad at this, though really stoked to work with it. But along my way, I've been running into the same problem a couple of times… Could someone please help me fix it?
I think the solution should either be really simple or impossible. I am hoping for the first.
So What I am trying to do is export a numbered pdf file, but Processing keeps numbering it as 0000. Is there a way that the pdf library numbers the exported file like 00001, 00002, 00003 ? Here's a breakdown of what's going wrong:
//Dat je een pdf wilt maken
import processing.pdf.*;
// Random waarde van 1 tot 100
float gok1 = random(0,100);
//ALGEMENE SETUP
void setup()
{
size(600, 800);
beginRecord(PDF,"frame_####.pdf");
background(255);
noStroke ();
smooth ();
if (gok1>50){ //als 50 groter is dan 50 (fifty-fifty kans)
gok1=400; // dan is a 400. A is dus altijd minder dan 50 of precies 550.
fill (random(200,255),random(255),random (255));
rect (20, 20, width-40, height -40);
}
endRecord();
exit ();
}
When it's done setting-up, I get this notification in the black box at the bottom:
isRecording(), or this particular variation of it, is not available with this renderer.
And all the files are just named frame_0000.pdf. What am I doing wrong?