We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello there,
I am working on a multimedia installation, for which I will import headlines from an rss feed and mix it with images from my archive.
My problem now is, that I would like to stretch the type vertically by around 120% and draw the headlines in all uppercase.
Somehow "toUpperCase()" seems to create a conflict with the xml.
Would be very happy to find out, how to solve this.
So this is what I got so far:
PImage[] drawing = new PImage[24];
PImage[] hg = new PImage[8];
PImage[] illu = new PImage[38];
PFont font;
float x; // horizontal location of headline
XML xml;
String[] headlines;
PFont myFont;
void setup(){
size(1920, 1080); colorMode(RGB); background(255,255,255); shapeMode(CENTER);
frameRate(1);
// The URL for the XML document
String url = "http://" + "www.dailymail.co.uk/tvshowbiz/index.rss";
// Load the XML document
xml = loadXML(url);
// Grab the element we want
XML[] headers = xml.getChildren("channel/item/title");
headlines = new String[headers.length];
for (int i = 0; i < headers.length; i++) {
headlines[i] = headers[i].getContent(); }
for(int i = 0; i<drawing.length; i++)
{drawing[i] = loadImage("d-"+ i +".png");}
for(int i = 0; i<hg.length; i++)
{hg[i] = loadImage("hg-"+ i +".png");}
for(int i = 0; i<illu.length; i++)
{illu[i] = loadImage("i-"+ i +".png");}
}
void draw(){ background(255, 255,255);
int zufall1 = int(random(24)); int zufall2 = int(random(8)); int zufall3 = int(random(38)); int zufall4 = int(random(18));
image(hg[zufall2], 0, 0, 700, 987);
image(drawing[zufall1], 1000, 0, 700, 987);
image(illu[zufall3], 0, 0, 700, 987);
text(headlines[zufall4], 200,0, 1500, 1080);
font = createFont("Arial Black.ttf", 152);
textFont(font);
fill(0, 0, 0);
textSize(152);
textLeading(140);
textAlign(CENTER, CENTER);
}
//saveFrame("t-##.jpg");
Answers
Please format your code. Edit your post (gear on top right side of any of your posts), select your code and hit ctrl+o. Leave an empty line above and below your block of code. Details here: https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Kf
sorry for that. I am really new here. thanks for your note on that.
move this to setup() - expensive stuff shouldn't be in draw()
and try not to link to the d a i l y m a i l.
(no technical reason, it's just a shitty newspaper)
that's the whole point of it. want to show how trash and stupid their headlines are
@koogs Can you clarify?
kf