| Total Complexity | 6 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from pypen import * |
||
| 2 | from math import sqrt |
||
| 3 | |||
| 4 | def start(): |
||
| 5 | settings.fps = 5 |
||
| 6 | |||
| 7 | |||
| 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 |