ENTRY | DOWNLOAD | MANUAL | ONGOING | |
tag_lines.py"""Animate lines on mouse click. by stephan) """ from slut import * from random import randint, choice class Atlantis(World): def onSetup(self): self.name = "Lines" self.width = 200 self.height = 200 for x in range(30): l = Lines(self, 'tag0'+str(x), randint(1, 5)) l.moveTo(randint(0, self.width), randint(0, self.height)) l.moveTo(SineTween(randint(-50, self.width-50), randint(0, self.height))) def onMouseButtonDown(self, event): for x in range(30): self.tags['tag0'+str(x)].rotTo( SineTween(choice([90, 180, 270, 360]), 0.0)) class Lines(Tag): def __init__(self, parent, name, sp): Tag.__init__(self, parent, name) self.sp = sp def onDraw(self): glColor4f(1.0, 0.5, 0.5,1.0) glLineWidth(self.sp) for x in range(7): glBegin(GL_LINES) glVertex3f(0+(20*x), 0, 0) glVertex3f(0+(20*x), 50, 0) glEnd() atlantis = Atlantis() atlantis.run() |
|
Initiated by Stephan Hechenberger Thanks to CADRE's 103 |