Last active
February 13, 2025 00:03
-
-
Save tado/eaebd702baccb899f0216aaffdf3c2d7 to your computer and use it in GitHub Desktop.
Revisions
-
tado revised this gist
Feb 13, 2025 . 1 changed file with 1 addition and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,9 +13,7 @@ def setup(): pos = Vector(random.uniform(0, width), random.uniform(0, height)) vel = Vector(random.uniform(-2.0, 2.0), random.uniform(-2.0, 2.0)) diameter = random.uniform(2, 40) color = Color(random.uniform(0, 255), random.uniform(0, 255), random.uniform(0, 255), 190) circles.append({'pos': pos, 'vel': vel, 'diameter': diameter, 'color': color}) def draw(): -
tado revised this gist
Feb 13, 2025 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,6 @@ circles = [] def setup(): size(width, height) no_stroke() for _ in range(circle_count): @@ -20,7 +19,6 @@ def setup(): circles.append({'pos': pos, 'vel': vel, 'diameter': diameter, 'color': color}) def draw(): background(0) for c in circles: fill(c["color"]) -
tado revised this gist
Feb 13, 2025 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,10 +13,10 @@ def setup(): for _ in range(circle_count): pos = Vector(random.uniform(0, width), random.uniform(0, height)) vel = Vector(random.uniform(-2.0, 2.0), random.uniform(-2.0, 2.0)) diameter = random.uniform(2, 40) color = Color(random.uniform(0, 255), random.uniform(0, 255), random.uniform(0, 255), 190) circles.append({'pos': pos, 'vel': vel, 'diameter': diameter, 'color': color}) def draw(): @@ -26,9 +26,9 @@ def draw(): fill(c["color"]) c["pos"] += c["vel"] if c["pos"].x > width or c["pos"].x < 0: c["vel"].x *= -1 if c["pos"].y > height or c["pos"].y < 0: c["vel"].y *= -1 circle((c["pos"].x, c["pos"].y), c["diameter"]) fill(255, 190) text_size(200) -
tado created this gist
Feb 12, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ from p5 import * import random width = 1280 height = 720 circle_count = 500 circles = [] def setup(): global width, height, circles, circle_count size(width, height) no_stroke() for _ in range(circle_count): pos = Vector(random.uniform(0, width), random.uniform(0, height)) vel = Vector(random.uniform(-2.0, 2.0), random.uniform(-2.0, 2.0)) diameter = random.randrange(2, 40) color = Color(random.randrange(0, 255), random.randrange(0, 255), random.randrange(0, 255), 190) circles.append({'pos': pos, 'vel': vel, 'diameter': diameter, 'color': color}) def draw(): global width, height, circles, circle_count background(0) for c in circles: fill(c["color"]) c["pos"] += c["vel"] if c["pos"].x > width or c["pos"].x < 0: c["vel"].x = -c["vel"].x if c["pos"].y > height or c["pos"].y < 0: c["vel"].y = -c["vel"].y circle((c["pos"].x, c["pos"].y), c["diameter"]) fill(255, 190) text_size(200) text_align('CENTER') text("Hello p5!", (640, 400)) run(renderer='skia')