def settings size(400, 400) end def setup sketch_title 'Resizable Surface' surface.set_resizable(true) end def draw background(255) stroke_weight 4 line(100, 100, width - 100, height - 100) end def key_pressed surface.set_size(rand(200..500).floor, rand(200..500).floor) end
In this sketch "sketch_title" actually calls surface under the hood with another 'set' method but we don't want these ugly get set prefixed methods in ruby do we. I guess I could similary "fix" resizable and convert set_size to sketch_size? And since true is given as default argument to resizable we don't need that either...
def settings size(400, 400) end def setup sketch_title 'Resizable Surface' resizable(true) end def draw background(255) stroke_weight 4 line(100, 100, width - 100, height - 100) end def key_pressed sketch_size(rand(200..500).floor, rand(200..500).floor) endOK a bit more experimentation also works with FX2D, blows up with P2D, but that's the same with vanilla processing (threading error).
No comments:
Post a Comment