Sebastian
Dec 25, 2012 - 14:11
Is there a way to change the origin of an ellipse to be in the center of the ellipse?
I'll put a little example under that demonstrates why this would be convenient in some cases.
from scene import *
class MyScene(Scene):
def setup(self):
self.pos = (self.bounds.center())
self.w = self.h = 100
self.p = Point(self.pos.x+self.h/2, self.pos.y+self.w/2)
self.colour = Color(1.00, 1.00, 1.00)
def draw(self):
background(0,0,0)
fill(*self.colour)
ellipse(self.pos.x, self.pos.y, self.w, self.h)
for t in self.touches.values():
#p = t.location.distance(self.pos)
p = t.location.distance(self.p)
text(str(p), x=100, y=100, font_size=24)
if p < self.w/2:
self.colour = Color(1.00, 0.00, 0.00)
else:
self.colour = Color(1.00, 1.00, 1.00)
run(MyScene())