Example #1
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)

		self.lastFlipCount=flipCount
		x,y=self.pos
		sz=self.params['sz']
		r=self.params['radius']
		res=self.params['res']
		if floor(sz/float(res))!=sz/float(res):
			sz=res*(sz//res)
		n=int(floor(flipCount/(float(self.params['duty'])*2.)))
		
		if n<len(self.params['squarenum']):
			self.currentPosition=self.params['squarenum'][n]
		else:
			self.currentPosition=0
		n=self.currentPosition
		
		color=mod(floor(flipCount/(self.params['duty'])),2)
		if color==0 and self.currentPosition>=1 and self.currentPosition<=res*res:
			if 'fgCal' in self.params.keys() and n-1<len(self.params['fgCal']):
				fg=(self.params['fgCal'][n-1].astype(float64)/255.)
				self.fg=(fg,fg,fg,1.)
			self.fgObjects[0].setColor(self.fg)
			self.firstFrame+=1
		else:
			self.fgObjects[0].setColor(self.bg)
			self.firstFrame=0
		if self.firstFrame<0:
			v=self.centerV
		else:
			cornerx=x-sz/2+mod(n-1,res)*sz/res
			cornery=y+sz/2-((n-1)//res)*sz/res
			v=[(cornerx,cornery),(cornerx+2*r,cornery),(cornerx+r*2,cornery-r*2),(cornerx,cornery-r*2)]
		self.fgObjects[0].setV(v)
Example #2
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)
		cycle=floor(flipCount/self.params['duty'])

		color=mod(cycle,2)
		if color==0:
			self.fgObjects[0].setColor(self.fg)
		else:
			self.fgObjects[0].setColor(self.bg)
Example #3
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)
		intensity=self.params['intensity']
		color=floor(flipCount/(self.params['duty']))
		on=mod(color, 2)
		color=int(floor(color/2.))
		if on==0 and color<len(intensity):
			c=intensity[color]
			self.fgObjects[0].setColor((c, c, c, 1))
		else:
			self.fgObjects[0].setColor(self.bg)
Example #4
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)
		durFlips=flipCount-self.preF
		tRes=float(self.params['res'])
		if mod(durFlips,tRes)==0:
			self.RC=(durFlips//tRes)
			c=(myrand[mod(self.RC,len(myrand))]*self.params['std']+self.params['mu'])
			if c<0:
				c =0
			elif c>1:
				c=1
			color=(c,c,c,1)
			self.fgObjects[0].setColor(color)
Example #5
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)
		durFlips=flipCount-self.preF
		try:
			tRes=float(self.params['res'][1])
			res=float(self.params['res'][0])
		except:
			tRes=3
			res=float(self.params['res'])
		if mod(durFlips,tRes)==0:
			x,y=self.pos
			sz=float(self.params['sz'])
			self.RC=(durFlips//tRes)*res*res
			for n in range(int(res**2)):
				c=(myrand[mod(self.RC+n,len(myrand))]*self.params['std']+self.params['mu'])
				if c<0:
					c =0
				elif c>1:
					c=1
				color=(c,c,c,1)
				self.fgObjects[n].setColor(color)
Example #6
0
	def updateObjects(self,flipCount):
		displayObject.updateObjects(self,flipCount)
		durFlips=flipCount-self.preF
		try:
			tRes=float(self.params['res'][1])
			res=float(self.params['res'][0])
		except:
			tRes=3
			res=float(self.params['res'])
		if mod(durFlips,tRes)==0:
			x,y=self.pos
			sz=float(self.params['sz'])

			self.RC=(durFlips//tRes)*res*res

			col=zeros(res**2)
			if mod(self.RC,len(myrand))+res**2>=len(myrand):
				col[:len(myrand)-mod(self.RC,len(myrand))]=myrand[mod(self.RC,len(myrand)):]*self.params['std']+self.params['mu']
				col[len(myrand)-mod(self.RC,len(myrand)):]=myrand[:len(col)-len(myrand)+mod(self.RC,len(myrand))]*self.params['std']+self.params['mu']
			else:
				col=myrand[mod(self.RC,len(myrand)):mod(self.RC,len(myrand))+res**2]*self.params['std']+self.params['mu']
			self.fgObjects[0].setColor(col)