Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.hamoid.*;
- VideoExport videoExport;
- XML root, channel, item, description, title;
- XML[] items;
- String[][] sources;
- PImage img;
- int c, edge;
- PFont font;
- boolean recording = true;
- void setup() {
- size(1080, 720);
- font = loadFont("Athelas-BoldItalic-48.vlw");
- textFont(font);
- edge = width/10;
- c=0;
- importSources();
- img=loadImage(sources[c][0]);
- videoExport = new VideoExport(this, "basic.mp4");
- }
- void draw() {
- background(20);
- noStroke();
- fill(255);
- text(sources[c][1], edge, 100);
- for (int x=edge; x<width-edge; x++) {
- int y = frameCount%height;
- int px = (int) map(x, edge, width-edge, 0, img.width);
- int py = (int) map(y, 0, height, 0, img.height);
- float br = brightness(img.get(px, py));
- // f = img.get(px, py);
- float f = map(br, 0, 255, 20, 255);
- float sz = map(br, 0, 255, 0, height/2);
- fill(f);
- rectMode(CENTER);
- rect(x, height/2, 1, sz);
- }
- if (frameCount%400==0) {
- background(20);
- for (int i=0; i<15; i++) {
- videoExport.saveFrame();
- }
- c++;
- img=loadImage(sources[c][0]);
- }
- if (recording && frameCount%2==0) videoExport.saveFrame();
- }
- void importSources() {
- root = loadXML("https://www.pinterest.com/xeronimo/famous-people-monochrome.rss");
- //root = loadXML("https://www.pinterest.com/xeronimo/as-far-as-the-eye-can-see.rss");
- channel = root.getChild("channel");
- items = channel.getChildren("item");
- sources = new String[items.length][2];
- for (int i=0; i<items.length; i++) {
- description = items[i].getChild("description");
- title = items[i].getChild("title");
- String d = description.getContent();
- String name = title.getContent();
- String start = "https://";
- String end = ".jpg";
- int indexStart = d.indexOf(start);
- int indexEnd = d.indexOf(end);
- String descr = d.substring(indexStart, indexEnd+4);
- sources[i][0] = descr;
- sources[i][1] = name;
- }
- }
- void keyPressed() {
- recording = false;
- println(recording);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement