Skip to content

Instantly share code, notes, and snippets.

@Krewn
Last active August 29, 2015 13:57
Show Gist options
  • Save Krewn/9823978 to your computer and use it in GitHub Desktop.
Save Krewn/9823978 to your computer and use it in GitHub Desktop.
Just a little drawing, Enjoy!
import sys
import os
#import and init pygame
import pygame
import numpy
def colPong(n,c):
n = int(int(n)/c)
n = n % 510
n = 510 - n if(n > 255) else n
return(int(n))
pygame.init()
def frange(x, y, jump):
while x <= y:
yield x
x += jump
w=1000
h=1000
c=500
s=300
f=13.0
n=70.0
r=1.5
b=1.0
e=300.0
f=f/2.0
window = pygame.display.set_mode((w, h))
x=[]
y=[]
for k in frange(-r*numpy.pi,r*numpy.pi,2.0*numpy.pi/n):
x.append(-1.0*numpy.cos(k)*1.0)
y.append(k)
print k
window.fill((200,200,200))
while b>=0:
half=0
if b%2==0:
half+=1
#window.fill((200,200,200))
for n in frange(0.0,2.0*f,1.0):
for k in range (len(x)/2,len(x),1):
x1=int((x[k]*numpy.cos((numpy.pi/f)*n-(b/e))-y[k]*numpy.sin((numpy.pi/f)*n-(b/e)))*(s/3.2)+c)
y1=int((x[k]*numpy.sin((numpy.pi/f)*n-(b/e))+y[k]*numpy.cos((numpy.pi/f)*n-(b/e)))*(s/3.2)+c)
x2=int((x[k-len(x)/2]*numpy.cos((numpy.pi/f)*(n-2)+(b/e))-y[k-len(x)/2]*numpy.sin((numpy.pi/f)*(n-2)+(b/e)))*(s/3.2)+c)
y2=int((x[k-len(x)/2]*numpy.sin((numpy.pi/f)*(n-2)+(b/e))+y[k-len(x)/2]*numpy.cos((numpy.pi/f)*(n-2)+(b/e)))*(s/3.2)+c)
col7=colPong(b,1.)
col9=colPong(b,3.)
pygame.draw.line(window,(col7,col9/3,255-col7),(x1,y1),(x2,y2))
pygame.display.flip()
b+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment