anniversaire.py

Created by numworks

Created on February 26, 2020

1.9 KB

Script pour les 4 ans de NumWorks !


from time import *
from kandinsky import *

def draw_candle():
  yellow = color(255,180,50)
  fill_rect(148,106,24,114,yellow)

def draw_wick():
  black = color(0,0,0)
  fill_rect(158,77,4,29,black)
  
def draw_flame(x,y):
  white = color(255,255,255)
  #RED
  red = color(250,111,16)
  fill_rect(x+164,y+96,4,3,red)
  fill_rect(x+168,y+73,4,23,red)
  fill_rect(x+164,y+65,4,8,red)
  fill_rect(x+159,y+62,5,4,red)
  fill_rect(x+155,y+60,4,17,red)
  fill_rect(x+152,y+77,4,7,red)
  fill_rect(x+148,y+84,4,12,red)
  fill_rect(x+152,y+96,4,3,red)
  #ORANGE
  orange = color(255,178,83)
  fill_rect(x+164,y+73,4,23,orange)
  fill_rect(x+159,y+66,5,18,orange)
  fill_rect(x+156,y+77,3,11,orange)
  fill_rect(x+152,y+84,4,12,orange)
  #LEMON
  lemon = color(250,230,170)
  fill_rect(x+156,y+88,8,11,lemon)
  fill_rect(x+159,y+84,5,4,lemon)
  sleep(0.15)
  #WHITE
  fill_rect(x+141,y+56,37,43,white)

def draw_smoke1(color):
  #SMOKE1
  fill_rect(154,60,4,29,color)
  fill_rect(162,64,4,29,color)
  fill_rect(158,19,4,58,color)
  
def draw_smoke2(color):
  #SMOKE2
  fill_rect(162,52,4,29,color)
  fill_rect(158,19,4,58,color)
  fill_rect(156,35,4,29,color)
  
def draw_smoke3(color):
  #SMOKE3
  fill_rect(162,36,4,29,color)
  fill_rect(158,19,4,58,color)
  fill_rect(154,0,4,29,color)
  
def draw_smoke4(color):
  #SMOKE4
  fill_rect(162,0,4,16,color)
  fill_rect(158,0,4,46,color)
  fill_rect(154,0,4,24,color)
  
  
def draw_smoke():
  t = 0.2
  white = color(255,255,255)
  fill_rect(141,56,37,43,white)
  draw_wick()
  grey = color(165,165,165)
  draw_smoke1(grey)
  sleep(t)
  draw_smoke1(white)
  draw_smoke2(grey)
  sleep(t)
  draw_smoke2(white)
  draw_smoke3(grey)
  sleep(t)
  draw_smoke3(white)
  draw_smoke4(grey)
  sleep(t)
  draw_smoke4(white)
  sleep(0.5)
  
draw_candle()
draw_wick()
while True:
  for i in range(3):
    draw_flame(-3,0)
    draw_flame(0,0)
    draw_flame(3,0)
    draw_flame(0,0)
  draw_smoke()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.