コード例 #1
0
ファイル: attraction.py プロジェクト: iglennrogers/attraction
class Worker( object ):
    def __init__( self, surface ):
        self.surface = surface
        self.points = 8
        self.segments = 20
        #
        self.world = Physics()
        self.world.set_world( self.surface.get_size() )
        self.world.set_repulsive_threshold( 100.0 )
        self.world.set_viscosity( 0.85 )
        #
        vertex_ring = create_initial_ring( self.surface, self.points, 10 )
        self.colour = ColourGen()
        self.polygon_chain = PolygonShapeChain( self.segments, vertex_ring, self.colour.current(), GlowingBallShape )
        #
    def run( self ):
        self.polygon_chain.draw( self.surface )
        self.polygon_chain.advance( self.world, self.colour.next_colour() )