Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Rainbow
- # Joe, 18/12/2014
- import appuifw as A
- import graphics as G
- def h2r(h,s,v):
- if s==0.0: return v,v,v
- i=int(h*6.0)
- f=(h*6.0)-i
- p=v*(1.0-s)
- q=v*(1.0-s*f)
- t=v*(1.0-s*(1.0-f))
- if i%6==0:return v,t,p
- if i==1:return q,v,p
- if i==2:return p,v,t
- if i==3:return p,q,v
- if i==4:return t,p,v
- if i==5:return v,p,q
- def gen(n=256):
- hsv=[(x*0.9/n,0.6,0.9) for x in xrange(n)]
- rgb=map(lambda x: tuple(map(lambda x:int(x*255), h2r(*x))),hsv)
- return rgb
- run=1
- def stop():
- global run
- run=0
- A.app.screen='full'
- A.app.body=c=A.Canvas()
- A.app.exit_key_handler=stop
- w,h=c.size
- img=G.Image.new((w,h))
- n=int(40)
- col=gen(n)
- x,y=0,h
- rx,ry=w/2+40,h/2+40
- for i in range(h+1):
- img.line((0,h-i,w,h-i),(123,174,5+i))
- for i in range(n):
- img.arc((x-rx-i,y-ry-i,x+rx+i,y+ry+i),0,90,col[i])
- txt='Rainbow - Joe...'
- ltext=txt[:]
- for i in range(len(ltext)):
- img.text((5+(i*8),h-10),u'%s' %ltext[i],col[i*2],(u'Sans MT 936_S60',26,G.FONT_BOLD))
- while run:
- c.blit(img)
- A.e32.ao_sleep(1e-04)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement