Sha256: abc2447f0bd2b4dcc9e4ea4062ff05ed28a1f5b5997c386fa9bdc8aa5fd47704
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'cf3' load_library 'control_panel' attr_accessor :resolution, :panel, :hide def setup_the_triangle @triangle = ContextFree.define do shape :tri do triangle size: 0.5, rotation: 180 split do tri size: 0.5, y: -0.578, x: 0, hue: 288, saturation: 0.2, brightness: 0.8 rewind tri size: 0.5, y: 0.289, x: -0.5, hue: 72, saturation: 0.2, brightness: 0.8 rewind tri size: 0.5, y: 0.289, x: 0.5, hue: 72, saturation: 0.2, brightness: 0.8 end end end end def setup size 600, 600 setup_the_triangle no_stroke @hide = false @resolution = 5 control_panel do |p| p.look_feel "Metal" # optionall set look and feel p.slider :resolution, (2..50), 5 @panel = p end end def draw unless hide panel.set_visible(true) # display panel after sketch frame @hide = true end background 0.1 @triangle.render :tri, size: height/1.1, color: [0, 0.5, 1.0, 1.0], stop_size: @resolution, start_y: height/1.65 end def mouse_clicked @hide = false end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cf3-0.0.5 | samples/sierpinski.rb |
cf3-0.0.4 | samples/sierpinski.rb |