Ruby-Processing

Out of context: Reply #6

  • Started
  • Last post
  • 39 Responses
  • stewdio0

    Ok. If you want to get all psychedelic with your color theory try this update and save it as MyCubes2.rb (or whatever you want to call it, it doesn't matter). And here's a little HSB-related color review while you're at it :
    http://en.wikipedia.org/wiki/HSL…

    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

    class MyCubes < Processing::App
    load_library :opengl

    def setup
    size 640, 360, OPENGL
    frame_rate 30
    @x_degree = 45
    @y_degree = 0
    @color_hue = 0
    color_mode HSB, 360
    no_stroke
    end

    def draw
    background_hue = ( @color_hue + 180 ).modulo 360
    background background_hue, 360, 360, 360
    lights
    push_matrix

    translate width / 2, height / 2, 0
    rotate_x radians( @x_degree )
    rotate_y radians( @y_degree )
    fill @color_hue, 360, 360, 320
    box 100

    pop_matrix
    @x_degree = ( @x_degree + 1 ).modulo 360
    @y_degree = ( @y_degree + 2 ).modulo 360
    @color_hue = ( @color_hue + 1 ).modulo 360
    end

    end
    MyCubes.new :title => "My COLORFUL Cubes!"

View thread