|
| 1 | +#!/usr/bin/env jruby |
| 2 | +# frozen_string_literal: true |
| 3 | +require 'propane' |
1 | 4 | # Talma Quality, Spectrum 2 Palette |
2 | | -PALETTE = %w(#D5C9D9 #B83D4E #95577E #A884A1).freeze |
3 | | -COULEURS = %i(pink_pearl geranium orchid lilac).freeze |
4 | | -STRPE = 500 |
| 5 | +class Stripes < Propane::App |
5 | 6 |
|
6 | | -def settings |
7 | | - size(3984, 3000) # dimensions in pixels (corresponds to 46-48" x 36" at 84 DPI) |
8 | | - no_smooth |
9 | | -end |
| 7 | + PALETTE = %w(#D5C9D9 #B83D4E #95577E #A884A1).freeze |
| 8 | + COULEURS = %i(pink_pearl geranium orchid lilac).freeze |
| 9 | + STRPE = 500 |
| 10 | + |
| 11 | + def settings |
| 12 | + size(3984, 3000) # dimensions in pixels (corresponds to 46-48" x 36" at 84 DPI) |
| 13 | + no_smooth |
| 14 | + end |
10 | 15 |
|
11 | | -def setup |
12 | | - sketch_title 'Horizontal Stripes' |
13 | | - web = COULEURS.zip(web_to_color_array(PALETTE)).to_h |
14 | | - background(web[:pink_pearl]) # draw the background |
15 | | - no_stroke # don't draw outlines around shapes |
| 16 | + def setup |
| 17 | + sketch_title 'Horizontal Stripes' |
| 18 | + web = COULEURS.zip(web_to_color_array(PALETTE)).to_h |
| 19 | + background(web[:pink_pearl]) # draw the background |
| 20 | + no_stroke # don't draw outlines around shapes |
16 | 21 |
|
17 | | - # Draw stripes at y = 0, 500, 1000, 1500, 2000, and 2500. |
18 | | - # Note that we're using the special variable "height", which is the height |
19 | | - # of the canvas (3000 pixels as specified in the call to size() above). |
20 | | - 0.step(by: STRPE, to: height) do |y| |
21 | | - # Draw the first stripe using the rect() function. |
22 | | - # Note that we're using the special variable "width", the analogue of |
23 | | - # "height". Its value is 3984. |
24 | | - fill(web[:geranium]) # set the color of the first rectangle |
25 | | - rect(0, y, width, 84) # corner at (0, y). full width, 84 pixels high. |
26 | | - # Draw two shorter stripes. |
27 | | - fill(web[:orchid]) |
28 | | - rect(0, y + 84 + 21, width, 10) # start 21 pixels (1/4") below the first stripe |
29 | | - fill(web[:lilac]) |
30 | | - rect(0, y + 84 + 42, width, 10) # start 42 pixels (1/2") below the first stripe |
| 22 | + # Draw stripes at y = 0, 500, 1000, 1500, 2000, and 2500. |
| 23 | + # Note that we're using the special variable "height", which is the height |
| 24 | + # of the canvas (3000 pixels as specified in the call to size() above). |
| 25 | + 0.step(by: STRPE, to: height) do |y| |
| 26 | + # Draw the first stripe using the rect() function. |
| 27 | + # Note that we're using the special variable "width", the analogue of |
| 28 | + # "height". Its value is 3984. |
| 29 | + fill(web[:geranium]) # set the color of the first rectangle |
| 30 | + rect(0, y, width, 84) # corner at (0, y). full width, 84 pixels high. |
| 31 | + # Draw two shorter stripes. |
| 32 | + fill(web[:orchid]) |
| 33 | + rect(0, y + 84 + 21, width, 10) # start 21 pixels (1/4") below the first stripe |
| 34 | + fill(web[:lilac]) |
| 35 | + rect(0, y + 84 + 42, width, 10) # start 42 pixels (1/2") below the first stripe |
| 36 | + end |
| 37 | + save(data_path('stripes.png')) # save the output to data folder |
31 | 38 | end |
32 | | - save(data_path('stripes.png')) # save the output to data folder |
33 | 39 | end |
| 40 | + |
| 41 | +Stripes.new |
0 commit comments