Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_checker_ani.py
- from random import randint as rndi
- from tkinter import *
- from math import cos, sin, radians, floor
- ww = 500
- hh = 500
- def rgb(r,g,b):
- return '#{:02x}{:02x}{:02x}'.format(r,g,b)
- bg_color = rgb(136,19,8)
- root = Tk()
- canvas = Canvas(root,width=ww,height=hh,bg=bg_color)
- canvas.pack()
- '''
- s=50,r=0,draw=a=>{for(r||createCanvas(W=500,W,WEBGL),background(136,19,8),i=0;
- i<121;i++)push(),translate(i%11*s-W/2,floor(i/11)*s-W/2,0),rotateY(i/22+r),
- rotateX(sin(r/10)/2),fill([0,255][i%2]),box(s,s,1),pop();r+=.05}
- '''
- s=50
- s2=s/2
- r=0
- while 1:
- canvas.delete('all')
- for i in range(121):
- zzz = sin(r*0.01)*1 ###
- x,y = int(i%11*s)-250, int(floor(i/11)*s) ###
- x2 = sin(i*0.05+r)/2*s ###
- y2 = s2-(cos(i/11+r)/2*22*zzz)
- fg_color = ['white','black'][i%2] ###
- box = [(x+xx+y2*10,y+yy) for xx,yy in [(-x2,-s2),(-x2,y2),(x2,s2),(x2,-y2)]]
- canvas.create_polygon(box,fill=fg_color,outline='')
- r=r+0.0002
- canvas.update()
Add Comment
Please, Sign In to add comment