Sha256: e62a2cda2549c3a8e1010bdee84fff4d7b7b62ed1de52855f8f66b1b5abd9b33

Contents?: true

Size: 964 Bytes

Versions: 34

Compression:

Stored size: 964 Bytes

Contents

---
layout: post
title:  "draw"
permalink: methods/draw.html
---
Called directly after setup, the draw function continuously executes the lines of code contained inside its block until the program is stopped or no_loop is called. The number of times draw executes in each second may be controlled with the frame_rate(xxx).

It is common to call background near the beginning of the [draw loop][draw] to clear the contents of the window. Since pixels drawn to the window are cumulative, omitting background may result in unintended results, especially when drawing anti-aliased shapes or text.

There can only be one [draw][draw] function for each sketch, and [draw][draw] must exist if you want the code to run continuously, or to process events such as [mouse_pressed][mouse_pressed].

```ruby
def draw
  background 0
  # dynamic code
end
```

[draw]:https://processing.org/reference/draw_.html
[mouse_pressed]:https://processing.org/reference/mousePressed_.html

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
picrate-2.5.2-java docs/_methods/draw.md
picrate-2.5.1-java docs/_methods/draw.md
picrate-2.5.0-java docs/_methods/draw.md
picrate-2.4.2-java docs/_methods/draw.md
picrate-2.4.1-java docs/_methods/draw.md
picrate-2.4.0-java docs/_methods/draw.md
picrate-2.3.0-java docs/_methods/draw.md
picrate-2.2.0-java docs/_methods/draw.md
picrate-2.1.2-java docs/_methods/draw.md
picrate-2.1.1-java docs/_methods/draw.md
picrate-2.1.0-java docs/_methods/draw.md
picrate-2.0.1-java docs/_methods/draw.md
picrate-1.3.0-java docs/_methods/draw.md
picrate-2.0.0.pre-java docs/_methods/draw.md
picrate-1.2.4-java docs/_methods/draw.md
picrate-1.2.3-java docs/_methods/draw.md
picrate-1.2.2-java docs/_methods/draw.md
picrate-1.2.1-java docs/_methods/draw.md
picrate-1.2.0-java docs/_methods/draw.md
picrate-1.1.0-java docs/_methods/draw.md