re-entrant
This commit is contained in:
parent
5eb52fd0cf
commit
59bad0c25e
@ -24,7 +24,6 @@ class Ball(Circle):
|
|||||||
if self.y > world.HEIGHT + 20:
|
if self.y > world.HEIGHT + 20:
|
||||||
self.move(0, -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):
|
class GravityBall(Circle):
|
||||||
@ -40,5 +39,6 @@ class GravityBall(Circle):
|
|||||||
self.speed *= -0.98 # dampening
|
self.speed *= -0.98 # dampening
|
||||||
self.pos(self.x, world.HEIGHT - 10.01)
|
self.pos(self.x, world.HEIGHT - 10.01)
|
||||||
|
|
||||||
|
def create():
|
||||||
grav = [GravityBall().pos(20+40*i, 0).radius(10).color(Color.PURPLE) for i in range(21)]
|
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)]
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
from doodles.doodles import Group, Circle, Color
|
from doodles.doodles import Group, Circle, Color
|
||||||
from doodles.world import world
|
from doodles.world import world
|
||||||
|
|
||||||
c = Circle()
|
def create():
|
||||||
|
g = Group().pos(400, 300)
|
||||||
g = Group().pos(400, 300)
|
for r in range(20, 50, 5):
|
||||||
for r in range(20, 50, 5):
|
|
||||||
Circle(g).radius(r).color(Color.random()).z_index(-r)
|
Circle(g).radius(r).color(Color.random()).z_index(-r)
|
||||||
for r in range(60, 150, 10):
|
for r in range(60, 150, 10):
|
||||||
Circle(g).radius(r).color(Color.random()).z_index(-r)
|
Circle(g).radius(r).color(Color.random()).z_index(-r)
|
||||||
|
@ -7,10 +7,7 @@ def original():
|
|||||||
c = c.copy().move(45, 45)
|
c = c.copy().move(45, 45)
|
||||||
return g
|
return g
|
||||||
|
|
||||||
r = original()
|
def create():
|
||||||
r.copy().move(200, 0).color(Color.GREEN)
|
r = original()
|
||||||
r.copy().move(400, 0).color(Color.BLUE)
|
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)
|
|
||||||
|
@ -9,5 +9,6 @@ def same_spiral():
|
|||||||
Line(g).vec(d, 200 - d)
|
Line(g).vec(d, 200 - d)
|
||||||
yield g
|
yield g
|
||||||
|
|
||||||
# Make copies, moving each one and modifying the color
|
def create():
|
||||||
make_grid(same_spiral(), 3, 4, 250, 140, x_offset=70, y_offset=20)
|
# Make copies, moving each one and modifying the color
|
||||||
|
make_grid(same_spiral(), 3, 4, 250, 140, x_offset=70, y_offset=20)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from doodles.doodles import Group, Rectangle, Color
|
from doodles.doodles import Group, Rectangle, Color
|
||||||
|
|
||||||
for _ in range(100):
|
def create():
|
||||||
|
for _ in range(100):
|
||||||
r = Rectangle().random(250)
|
r = Rectangle().random(250)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ def load_module(modname):
|
|||||||
raise ImportError(
|
raise ImportError(
|
||||||
f"Tried to import {modname} and doodles.examples.{modname}"
|
f"Tried to import {modname} and doodles.examples.{modname}"
|
||||||
)
|
)
|
||||||
return mod
|
return mod.create()
|
||||||
|
|
||||||
|
|
||||||
def main(modname: str = None):
|
def main(modname: str = None):
|
||||||
|
Loading…
Reference in New Issue
Block a user