10 Minutes of Very Cool Colorful Visual Effects I made with AI and Python!

Поділитися
Вставка
  • Опубліковано 26 лис 2024

КОМЕНТАРІ • 2

  • @GregSeymourAI
    @GregSeymourAI  3 місяці тому +2

    # GREG SEYMOUR AI
    # I made this python code with AI.
    # Copy and Paste this code as a .py file and explore! change the numbers around!
    # Subscribe to my Channel for Fun Stuff to come!
    import pygame
    import math
    import random
    import colorsys
    pygame.init()
    screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
    width, height = screen.get_size()
    def hsv_to_rgb(h, s, v):
    return tuple(round(i * 255) for i in colorsys.hsv_to_rgb(h, s, v))
    def project_3d_to_2d(x, y, z, fov=100):
    factor = fov / (fov + z)
    return int(x * factor + width / 2), int(y * factor + height / 2)
    def spiral_pattern_3d(surface, time, params, trails):
    center_x, center_y = width // 2, height // 2
    max_radius = math.sqrt(width**2 + height**2) / 2
    num_arms = params['num_arms']
    rotation_speed = params['rotation_speed']
    color_shift = params['color_shift']
    arm_width = params['arm_width']
    spiral_tightness = params['spiral_tightness']
    direction = params['direction']
    z_scale = params['z_scale']
    z_speed = params['z_speed']
    pulsate = params['pulsate']
    reverse_time = params['reverse_time']
    for r in range(0, int(max_radius), arm_width):
    angle = r / spiral_tightness + time * rotation_speed * direction
    z = math.sin(r / z_scale + time * z_speed) * 200
    pulsate_factor = 1 + 0.5 * math.sin(time * pulsate)
    for arm in range(num_arms):
    arm_angle = angle + arm * 2 * math.pi / num_arms
    x = r * math.cos(arm_angle) * pulsate_factor
    y = r * math.sin(arm_angle) * pulsate_factor
    projected_x, projected_y = project_3d_to_2d(x, y, z)
    color = hsv_to_rgb((r / max_radius + time * color_shift) % 1, 1, 1)
    size = int(arm_width * (1 + z / 400))
    pygame.draw.circle(surface, color, (projected_x, projected_y), size // 2)
    trails.append(((projected_x, projected_y), size // 2, color))
    def draw_trails(surface, trails):
    for (x, y), size, color in trails:
    pygame.draw.circle(surface, color, (x, y), size)
    trails[:] = trails[-1000:] # Keep only the last 1000 trail points
    def main():
    clock = pygame.time.Clock()
    start_time = pygame.time.get_ticks()
    trails = []
    params = {
    'num_arms': random.randint(3, 20),
    'rotation_speed': random.uniform(0.05, 3),
    'color_shift': random.uniform(0.02, 0.05),
    'arm_width': random.randint(3, 25),
    'spiral_tightness': random.uniform(5, 50),
    'direction': random.choice([-1, 1]),
    'z_scale': random.uniform(100, 300),
    'z_speed': random.uniform(0.5, 2),
    'pulsate': random.uniform(0.5, 2),
    'reverse_time': random.randint(5, 15)
    }
    running = True
    while running:
    current_time = pygame.time.get_ticks()
    elapsed_time = (current_time - start_time) / 1000
    for event in pygame.event.get():
    if event.type == pygame.QUIT or event.type == pygame.MOUSEBUTTONDOWN:
    running = False
    if current_time - start_time >= 10000:
    params = {
    'num_arms': random.randint(3, 25),
    'rotation_speed': random.uniform(0.05, 5),
    'color_shift': random.uniform(0.02, 0.05),
    'arm_width': random.randint(3, 30),
    'spiral_tightness': random.uniform(5, 75),
    'direction': random.choice([-1, 1]),
    'z_scale': random.uniform(100, 300),
    'z_speed': random.uniform(0.5, 2),
    'pulsate': random.uniform(0.5, 2),
    'reverse_time': random.randint(5, 15)
    }
    start_time = current_time
    if int(elapsed_time) % params['reverse_time'] == 0:
    params['direction'] *= -1
    screen.fill((0, 0, 0))
    spiral_pattern_3d(screen, elapsed_time, params, trails)
    draw_trails(screen, trails)
    pygame.display.flip()
    clock.tick(60)
    pygame.quit()
    if __name__ == "__main__":
    main()

  • @GregSeymourAI
    @GregSeymourAI  2 місяці тому

    🪅🪅🪅🪅🪅