Conditions | 5 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from pypen import * |
||
8 | def update(): |
||
9 | pixel_size = 2 |
||
10 | points = [] |
||
11 | for i in range(3): |
||
12 | points.append((random(WIDTH), random(HEIGHT))) |
||
13 | |||
14 | for x, y in grid(pixel_size): |
||
15 | |||
16 | least_dis = 1000000000000000000 |
||
17 | |||
18 | for point in points: |
||
19 | d = sqrt((x - point[0])**2 + (y - point[1])**2) |
||
20 | least_dis = d if d < least_dis else least_dis |
||
21 | |||
22 | value = clamp(remap(least_dis, 0, 300, 255, 0), 0, 255) |
||
23 | color = (value, 30, 125 + 125 * sin((value**3) / 170000)) |
||
24 | rectangle(x, y, pixel_size, pixel_size, color) |
||
|
|||
25 |