re-entrant

This commit is contained in:
James Turk 2024-04-22 01:39:33 -05:00
parent 5eb52fd0cf
commit 59bad0c25e
6 changed files with 20 additions and 23 deletions

View File

@ -24,7 +24,6 @@ class Ball(Circle):
if self.y > world.HEIGHT + 20:
self.move(0, -world.HEIGHT-20)
balls = [Ball().pos(40*i, 0).radius(10).color(Color.BLUE) for i in range(21)]
class GravityBall(Circle):
@ -40,5 +39,6 @@ class GravityBall(Circle):
self.speed *= -0.98 # dampening
self.pos(self.x, world.HEIGHT - 10.01)
grav = [GravityBall().pos(20+40*i, 0).radius(10).color(Color.PURPLE) for i in range(21)]
def create():
balls = [Ball().pos(40*i, 0).radius(10).color(Color.BLUE) for i in range(21)]
grav = [GravityBall().pos(20+40*i, 0).radius(10).color(Color.PURPLE) for i in range(21)]

View File

@ -1,10 +1,9 @@
from doodles.doodles import Group, Circle, Color
from doodles.world import world
c = Circle()
g = Group().pos(400, 300)
for r in range(20, 50, 5):
Circle(g).radius(r).color(Color.random()).z_index(-r)
for r in range(60, 150, 10):
Circle(g).radius(r).color(Color.random()).z_index(-r)
def create():
g = Group().pos(400, 300)
for r in range(20, 50, 5):
Circle(g).radius(r).color(Color.random()).z_index(-r)
for r in range(60, 150, 10):
Circle(g).radius(r).color(Color.random()).z_index(-r)

View File

@ -7,10 +7,7 @@ def original():
c = c.copy().move(45, 45)
return g
r = original()
r.copy().move(200, 0).color(Color.GREEN)
r.copy().move(400, 0).color(Color.BLUE)
# from doodles.world import world
# for d in world._drawables:
# print(" >", d)
def create():
r = original()
r.copy().move(200, 0).color(Color.GREEN)
r.copy().move(400, 0).color(Color.BLUE)

View File

@ -9,5 +9,6 @@ def same_spiral():
Line(g).vec(d, 200 - d)
yield g
# Make copies, moving each one and modifying the color
make_grid(same_spiral(), 3, 4, 250, 140, x_offset=70, y_offset=20)
def create():
# Make copies, moving each one and modifying the color
make_grid(same_spiral(), 3, 4, 250, 140, x_offset=70, y_offset=20)

View File

@ -1,5 +1,5 @@
from doodles.doodles import Group, Rectangle, Color
for _ in range(100):
r = Rectangle().random(250)
def create():
for _ in range(100):
r = Rectangle().random(250)

View File

@ -30,7 +30,7 @@ def load_module(modname):
raise ImportError(
f"Tried to import {modname} and doodles.examples.{modname}"
)
return mod
return mod.create()
def main(modname: str = None):