Пример #1
0
 def start(self):
     """ instead of using __init__() they implement start() which happens right after init
     this can made code cleaner in some cases
     """
     self.delta = utilities.seed.choice([-1,1]) # accessing the random seed in utilities module directly
     self.interactiveState = 2 # dragabble
     self.destColor = utilities.randRGBA()
Пример #2
0
 def start(self):
     """ instead of using __init__() they implement start() which happens right after init
     this can made code cleaner in some cases
     """
     self.delta = utilities.seed.choice(
         [-1, 1])  # accessing the random seed in utilities module directly
     self.interactiveState = 2  # dragabble
     self.destColor = utilities.randRGBA()
Пример #3
0
 def start(self):
     """ do some dragggable circles
     """
     for z in range(100):
         x, y = utilities.randPoint(0, 0, self.size[0], self.size[1])
         w = utilities.randint(0, 100)
         c = Circle(x,y,z,w, color = utilities.randRGBA())
         c.interactiveState = 2 # draggable
Пример #4
0
 def start(self):
     self.rect = 0,0, self.size[0], self.size[1]
     self.drunks = []
     for z in range(100):
         x,y = utilities.randPoint(rect=self.rect)#0,0, self.size[0], self.size[1])
         w = utilities.randint(20,40)
         c = utilities.randRGBA()
         s = utilities.choice((GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         self.drunks.append(Drunk(x,y,z,w, color=c, style=s))
Пример #5
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         y = utilities.randint(0, self.size[0])
         h = utilities.randint(1, 200)
         c = utilities.randRGBA()
         Strippe(y, z, h, c, self.size)
Пример #6
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         y = utilities.randint(0, self.size[0])
         h = utilities.randint(1, 200)
         c = utilities.randRGBA()
         Strippe(y, z, h, c, self.size)
Пример #7
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for i in range(100):
         x, y = utilities.randPoint(0, 0, self.width, self.height)
         d = utilities.randint(10, 30)
         bl = Blob(x, y, i + 1, d, d, utilities.randRGBA())
         bl.interactiveState = 2  #draggable
Пример #8
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for i in range(100):
         x,y = utilities.randPoint(0, 0, self.width, self.height)
         d = utilities.randint(10, 30)
         bl = Blob(x, y, i+1, d, d, utilities.randRGBA())
         bl.interactiveState = 2 #draggable
Пример #9
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     self.trails = 1
     for z in range(50):
         x,y = utilities.randPoint(0,0,self.height, self.width)
         s = utilities.choice((GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         Expands(x,y,z, utilities.randint(1,300), utilities.randRGBA(),
                 utilities.randint(1,140), style = s).interactiveState = 2
Пример #10
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(100):
         x = utilities.randint(0, self.width)
         y = utilities.randint(0, self.height)
         h = utilities.randint(2, 20)
         w = utilities.randint(2, 20)
         c = utilities.randRGBA()
         Planet(x, y, z, h, w, c)
Пример #11
0
 def start(self):
     self.rect = 0, 0, self.size[0], self.size[1]
     self.drunks = []
     for z in range(100):
         x, y = utilities.randPoint(
             rect=self.rect)  #0,0, self.size[0], self.size[1])
         w = utilities.randint(20, 40)
         c = utilities.randRGBA()
         s = utilities.choice(
             (GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         self.drunks.append(Drunk(x, y, z, w, color=c, style=s))
Пример #12
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(100):
         x = utilities.randint(0, self.width)
         y = utilities.randint(0, self.height)
         h = utilities.randint(2, 20)
         w = utilities.randint(2, 20) 
         c = utilities.randRGBA()
         Planet(x, y, z, h, w, c)
Пример #13
0
    def start(self) :
        self.nextstep = [0,0] # note is array and not tupple. Speed of each step
##        self.perching = 0
##        self.perch_timer = 0
        self.f1 = 0
        self.f2 = 0
        self.f3 = 0

        self.loc = utilities.randPoint(0, 0, self.app.width, self.app.height)
        self.color = utilities.randRGBA()
        self.width = utilities.randint(6,12)
        self.height = utilities.randint(6,12)
Пример #14
0
    def start(self):
        self.nextstep = [0,
                         0]  # note is array and not tupple. Speed of each step
        ##        self.perching = 0
        ##        self.perch_timer = 0
        self.f1 = 0
        self.f2 = 0
        self.f3 = 0

        self.loc = utilities.randPoint(0, 0, self.app.width, self.app.height)
        self.color = utilities.randRGBA()
        self.width = utilities.randint(6, 12)
        self.height = utilities.randint(6, 12)
Пример #15
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     ##        self.trails = 1
     for z in range(50):
         x, y = utilities.randPoint(0, 0, self.height, self.width)
         s = utilities.choice(
             (GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         Expands(x,
                 y,
                 z,
                 utilities.randint(1, 300),
                 utilities.randRGBA(),
                 utilities.randint(1, 140),
                 style=s).interactiveState = 2
Пример #16
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """
        s = 'Size must fit your screen resolution under fullscreen mode, otherwise weird stuff happens'
        Text(s, 10, 100, 900, 'timesroman', 12)

        s = 'press scape to exit'
        Text(s, 10, 150, 900, 'timesroman', 12)

        for z in range(150):
            w,h = self.size
            x,y = utilities.randPoint(1,1,w,h)
            c = utilities.randRGBA()
            o = Rect(x,y,z, 40,40, c)
            o.interactiveState = 2 # this doesnt seem to affect the performance
Пример #17
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     self.trails = 1
     self.bgColor = 1, 1, 0, 0.06 # an alpha value causes fade out (better with values between 0.02 - 0.1)
     self.mouseVisible = 0 # hide mouse
     
     for z in range(100):
         w,h = self.size
         x,y = utilities.randPoint(0,0,w,h)
         d = utilities.randint(20, 50)
         rot = utilities.randint(1, 360)
         c = utilities.randRGBA()
         stroke = utilities.randint(0, (d/2)-5)
         deltax = deltay = 0
         while deltax==0 : deltax = utilities.randint(-20, 20)/10.0
         while deltay==0 : deltay = utilities.randint(-20, 20)/10.0
         b = BouncingBall(x, y, z, d, c, stroke, rot)#, style=GLU_POINT)
         b.delta = [deltax, deltay]
Пример #18
0
    def step(self):
        """ increase size until 300 and then decrease down to 0
        change towards destination color, if reached choose new destination
        """
        self.width += self.delta
        if self.width > 300 or self.width < 1 : self.delta = -self.delta

        if self.color != self.destColor :
            r = self.color[0] + (self.destColor[0]-self.color[0])*0.005
            if self.destColor[0] - r < 0.005 : r = self.destColor[0] # snap
            g = self.color[1] + (self.destColor[1]-self.color[1])*0.005
            if self.destColor[1] - g < 0.005 : g = self.destColor[1] # snap
            b = self.color[2] + (self.destColor[2]-self.color[2])*0.005
            if self.destColor[2] - b < 0.005 : b = self.destColor[2] # snap
            a = self.color[3] + (self.destColor[3]-self.color[3])*0.005
            if self.destColor[3] - a < 0.005 : a = self.destColor[3] # snap
            self.color = r,g,b,a
            #print self.color, self.destColor
        else :
            self.destColor = utilities.randRGBA()
Пример #19
0
    def step(self):
        """ increase size until 300 and then decrease down to 0
        change towards destination color, if reached choose new destination
        """
        self.width += self.delta
        if self.width > 300 or self.width < 1: self.delta = -self.delta

        if self.color != self.destColor:
            r = self.color[0] + (self.destColor[0] - self.color[0]) * 0.005
            if self.destColor[0] - r < 0.005: r = self.destColor[0]  # snap
            g = self.color[1] + (self.destColor[1] - self.color[1]) * 0.005
            if self.destColor[1] - g < 0.005: g = self.destColor[1]  # snap
            b = self.color[2] + (self.destColor[2] - self.color[2]) * 0.005
            if self.destColor[2] - b < 0.005: b = self.destColor[2]  # snap
            a = self.color[3] + (self.destColor[3] - self.color[3]) * 0.005
            if self.destColor[3] - a < 0.005: a = self.destColor[3]  # snap
            self.color = r, g, b, a
            #print self.color, self.destColor
        else:
            self.destColor = utilities.randRGBA()
Пример #20
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """
        self.trails = 1
        self.bgColor = 1, 1, 0, 0.06  # an alpha value causes fade out (better with values between 0.02 - 0.1)
        self.mouseVisible = 0  # hide mouse

        for z in range(100):
            w, h = self.size
            x, y = utilities.randPoint(0, 0, w, h)
            d = utilities.randint(20, 50)
            rot = utilities.randint(1, 360)
            c = utilities.randRGBA()
            stroke = utilities.randint(0, (d / 2) - 5)
            deltax = deltay = 0
            while deltax == 0:
                deltax = utilities.randint(-20, 20) / 10.0
            while deltay == 0:
                deltay = utilities.randint(-20, 20) / 10.0
            b = BouncingBall(x, y, z, d, c, stroke, rot)  #, style=GLU_POINT)
            b.delta = [deltax, deltay]