Explain yourself with reStructured Text, embedded code, graphs, charts, and LaTeX–style math.
Join Siafoo Now
or
Learn More
Nodebox Repetition Tutorial, "For" loops and Ovals
| In Brief | Sample code first seen in the Nodebox Repetition Tutorial. This snippet introduces the use of "for" loops in combination with randomized size and position parameters to generate probabilistic patterns of ovals.... more |
| Language | Nodebox Python |
# 's
1size(400,400)
2
3fill(0,0.6,0.9,0.1)
4stroke(0,0.6,0.9)
5strokewidth(0.25)
6
7for i in range(100):
8
9 x = random(WIDTH)
10 y = random(HEIGHT)
11 r = random(50,100)
12
13 oval(x,y,r,r)
Sample code first seen in the Nodebox Repetition Tutorial. This snippet introduces the use of "for" loops in combination with randomized size and position parameters to generate probabilistic patterns of ovals.
Add a Comment