Sha256: 062166fb5a0ee41106398a2a0ff4b657ac88601f33ef290b7d32c693aebf8548
Contents?: true
Size: 710 Bytes
Versions: 34
Compression:
Stored size: 710 Bytes
Contents
--- layout: post title: "setup" permalink: methods/setup.html --- All sketches will propably have a user defined [setup][setup] method. This is where you define the sketch title and where static code belongs. ```ruby def setup sketch_title 'My sketch' # ... static code end ``` Note to make variables declared in setup in the rest of sketch, you can make use of ruby `attr_reader` as for the `pts` array below. ```ruby attr_reader :pts def setup sketch_title 'My sketch' @pts = [] # ... static code end ``` When the you can access `pts` in say the draw loop ```ruby def draw p pts.length # ... static code end ``` [settings]:https://processing.org/reference/setup_.html
Version data entries
34 entries across 34 versions & 1 rubygems