ENTRY | DOWNLOAD | MANUAL | ONGOING | |
arrow_morph.py"""Morph an s to an arrow. by stephan) """ from slut import * import math from random import choice from slut.context import AnimatedGifMaker class Atlantis(World): def onSetup(self): self.width = 300 self.height = 150 self.name = "Points" self.fps = 30 glClearColor(1.0, 1.0, 1.0, 1.0) glColor4f(0.82, 0.0, 0.0, 1.0) glPointSize(5) self. arrowcvs = [ [2, 0, 0], [1.75, 0.25, 0], [1.75, -0.25, 0], [1.5, 0.5, 0], [1.5, -0.5, 0], [1.75, 0, 0], [1.5, 0, 0], [1, 0, 0], [0.5, 0, 0], [0, 0, 0], ] for x in range(50): p = Point(self, str(x)) p.moveTo(math.sin(x), math.cos(x), math.tan(x)) self.camera.moveBy(0, 0, 1.5) #self.addContext(AnimatedGifMaker(1, 200)) reactor.callLater(1.0, self.cam1) reactor.callLater(2.5, self.morph) reactor.callLater(3.0, self.cam2) def cam1(self): self.camera.orbitTo(SineTween(0, 20, 0, 2)) def cam2(self): self.camera.orbitTo(SineTween(0, 0, 0, 1)) def morph(self): for x in range(50): loc = choice(self.arrowcvs) self.sprites[str(x)].moveTo(SineTween(loc[0], loc[1], loc[2], 2.0)) class Point(Sprite): def onDraw(self): glBegin(GL_POINTS) glVertex3f(0, 0, 0) glEnd() atlantis = Atlantis() atlantis.run() |
|
Initiated by Stephan Hechenberger Thanks to CADRE's 103 |