Sha256: b39957d63e14f23f091336d25d065d846fdc794198c85cba1bbeb9d3224b2e85

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

---
layout: post
title:  "A first Sketch"
date:   2017-03-07 07:34:13
categories: wordcram update
---

### Requirements

Requires JRubyArt-1.3.0+ (hence jruby-9.0.8.0+)

### Install the ruby_wordcram gem

```bash
jruby -S gem install ruby_wordcram # safe way
gem install ruby_wordcram # using rvm rbenv to use jruby instead of MRI
```

Create basic sketch

`mkdir data` and install fonts see below

```ruby
# This sketch shows how to make a WordCram from any webpage.
# It uses my blog
# Minya Nouvelle font available at http://www.1001fonts.com/font_details.html?font_id=59

require 'ruby_wordcram'

def settings
  size 800, 400
end

def setup
  sketch_title 'WordCram from Web Page'
  color_mode(HSB)
  background(255)
  WordCram.new(self)
          .from_web_page('https://ruby-processing.github.io/about/')
          .with_font(create_font(data_path('MINYN___.TTF'), 1))
          .with_colorer(Colorers.two_hues_random_sats_on_white(self))
          .sized_by_weight(7, 100)
          .draw_all
end
```

### Output

<img src="{{ site.github.url }}/assets/wordcram.png" />
Follow links for more JRubyArt [examples][examples] or [propane examples][propane examples].

Usage with propane is essentially the same but with a class wrapper.

[examples]:https://github.com/ruby-processing/JRubyArt-examples/tree/master/external_library/gem/ruby_wordcram/
[propane examples]:https://github.com/ruby-processing/propane-examples/tree/master/external_library/gem/ruby_wordcram

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby_wordcram-2.0.0 docs/_posts/2017-03-07-getting_started.md