Pages

Thursday, May 8, 2014

thought I'd try a snowflake.

It all makes sense when i put pencil to paper, but then I try and put it into a program, and Epic Fail.


But this is what I got playing with Pygame.

It's just 1/12 of the snowflake.  Just gotta figure out how to rotate it, and mirror it.  Like 11 more times.  then add the prongs to the rest.

import pygame
from pygame.locals import*
import math
from sys import exit
from random import randint



def run():
    pygame.init()
    screen= pygame.display.set_mode((800, 800))
   
    R = 375  # radius
   
    # Rx = (1.15 * R)  = 431
   
    # Ry =( sqrt((375)**2 + (431)**2))
   
    # Ry = 196
   
   

        # center point (375, 375)  origin line (375, 0)
   
   
    clock = pygame.time.Clock()
   
   
    while True:
   
        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
       
        change = randint(2, 175)
        n = 0.222222
        n2 = 0.5
        i = 0.111
        variance = 196
        x = (750)
        y = (750)
        x2 = (375)
        y2 = ( 0)   
        time_passed = clock.tick()
        time_passed_seconds = time_passed/1000

        screen.fill((0, 0, 0))

       
        Rainbow = (randint(0,255), randint(0, 255), randint(0,255))   
        O = randint(0, 375)
                    #   origin   (375, 375), (0, 750)
                    #  origin (375, 375), (750, 375)
        pygame.draw.line(screen, Rainbow, (375, 375), (x2, y2), 5)
        pygame.draw.line(screen, Rainbow, (x2, y* n * 2), (x2 - 270, x2 * n * 2), 6 )
        pygame.draw.line(screen, Rainbow, (x2, y * n ), ( x2 - 180, x2 *n), 5)   
        pygame.draw.line(screen, Rainbow, (x2, y * n * n2), ( x2 - 120, x2 * n * n), 4)
        pygame.draw.line(screen, Rainbow, (x2, y * n *n *n2), ( x2 - 30, x2 * n *n *n ), 3)    
        clock.tick(90)   
       

        pygame.display.update()

if __name__ == "__main__":
    run()

   

No comments:

Post a Comment