WordCram

open-source word clouds for Processing

Follow WordCram on Twitter @wordcram

Ask a Question in the Forum /wordcram

Pull Requests Welcome on GitHub danbernier/WordCram

Latest News

WordCram 1.0.0 Released, for Processing 3.0

WordCram 0.6.2 Released

WordCram 0.6.1 Released

All posts

See You at Barcamp Boston 6

http://www.barcampboston.org/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import wordcram.*;

void setup() {
  size(900, 500);
  colorMode(HSB);
}

void draw() {
  background(68);
  color red = color(0, 255, 255);
  color mustard = color(30, 255, 255);

  new WordCram(this)
    .fromWebPage("http://en.wikipedia.org/wiki/Barcamp")
    .withColors(color(0, 0, 0),
                color(0, 0, 255),
                mustard) // red)
    .withFonts(PFont.list())
    .withAngler(moreRandomByWeight())
    .withPlacer(crazyPlacer())
    .sizedByWeight(8, 100)
    .maxNumberOfWordsToDraw(300)
    .drawAll();
}

WordAngler moreRandomByWeight() {
  return new WordAngler() {
    public float angleFor(Word w) {
      float range = (1-w.weight) * PI;
      return random(-range, range);
    }
  };
}

WordPlacer crazyPlacer() {
  return new WordPlacer() {
    public PVector place(Word w, int rank, int words,
                        int ww, int wh, int fw, int fh) {
      float x = (fw-ww) * (1-w.weight);
      float y = random(fh-wh);
      return new PVector(x, y);
    }
  };
}

<<

>>