Monday, 7 March 2011

Rss feed illustrated

import processing.xml.*;

XMLElement xml;
XMLElement[] title;
XMLElement[] pubDate;
XMLElement[] value;



void setup()

{
  size(500,500);
 
  String url = "http://rss.news.yahoo.com/rss/topstories";
  XMLElement xml = new XMLElement(this,url);
 
  title = xml.getChildren("channel/item/title");
  pubDate = xml.getChildren("channel/item/pubDate");
  value = xml.getChildren("channel/item/description");
}

void draw()

{
for (int i =0; i<title.length; i++){

    float num1 = int(title[i].getContent().charAt(0));
      float num2=int(title[i].getContent().charAt(2));
            float num3=int(title[i].getContent().charAt(4));
             float num4=int(title[i].getContent().charAt(6));
       ellipse (num1,num2,num3,num4);
}
}

Rss feed

import processing.xml.*;

XMLElement xml;
XMLElement[] title;
XMLElement[] pubDate;
XMLElement[] value;



void setup()

{
  size(500,500);
 
  String url = "http://rss.news.yahoo.com/rss/topstories";
  XMLElement xml = new XMLElement(this,url);
 
  title = xml.getChildren("channel/item/title");
  pubDate = xml.getChildren("channel/item/pubDate");
  value = xml.getChildren("channel/item/description");
}

void draw()

{
for (int i =0; i<title.length; i++)

    println(title[i].getContent());
}

font randomiser

PFont f;


void setup()
{
size(200,200);
frameRate(5);
f=loadFont("DialogInput-48.vlw");
}


void draw()
{
float x=random(width);
float y=random(height);
background(255);
textFont(f,20);
fill(0);
text("HELLOOOOO",x,y);
}