lion.py

Created by arthurmichel-scolaire

Created on January 12, 2026

2.47 KB


from kandinsky import *
from math import cos, sin, pi
from random import randint

def d(x,y,r,c):
  if x+r<0 or x-r>320 or y+r<0 or y-r>222: return
  for i in range(-r,r+1):
    for j in range(-r,r+1):
      if i*i+j*j<=r*r:
        set_pixel(int(x+i),int(y+j),c)

# --- COULEURS ---
# Ciel
C1 = (200, 50, 50)   # Rouge
C2 = (220, 100, 50)  # Orange
C3 = (255, 160, 60)  # Orange clair
C4 = (255, 220, 100) # Jaune pale

# Lion
BrunFonce = (100, 50, 20)
Brun      = (160, 82, 45)
Or        = (210, 140, 50)    # Pelage principal
Fauve     = (244, 164, 96)    # Peau visage
Sable     = (255, 228, 196)   # Museau clair
Nez       = (80, 30, 30)
Blanc     = (255, 255, 255)
Noir      = (0, 0, 0)

# 1. FOND COUCHER DE SOLEIL
d(160, 140, 200, C1)
d(160, 140, 160, C2)
d(160, 140, 120, C3)
d(160, 140, 80, C4)

# 2. HERBE (Derriere le corps)
for x in range(0, 330, 10):
  d(x, 220, 15, (100, 160, 60))

# 3. LE CORPS (AJOUT DEMANDE)
# Un grand disque dore en bas qui fait le buste
d(160, 240, 75, Or)
# Un disque plus clair pour le poitrail
d(160, 240, 45, Sable)

# 4. LA CRINIERE (Par-dessus le corps)
cx, cy = 160, 110

# Couche 1 (Foncee large)
for i in range(120):
  rad = (i * 3 + randint(-5, 5)) * pi / 180
  dist = 65 + randint(0, 10)
  d(cx+dist*cos(rad), cy+dist*sin(rad), 18, BrunFonce)

# Couche 2 (Intermediaire)
for i in range(100):
  rad = (i * 3.6) * pi / 180
  dist = 55 + randint(-5, 5)
  d(cx+dist*cos(rad), cy+dist*sin(rad), 15, Brun)

# Couche 3 (Interne claire)
for i in range(80):
  rad = (i * 4.5) * pi / 180
  dist = 45 + randint(-2, 2)
  d(cx+dist*cos(rad), cy+dist*sin(rad), 12, Or)

# 5. LE VISAGE (VERSION 1)
# Oreilles
d(115, 70, 18, Fauve)
d(205, 70, 18, Fauve)
d(115, 70, 10, (100, 50, 50))
d(205, 70, 10, (100, 50, 50))

# Tete
d(cx, cy, 50, Fauve)
d(cx, cy+25, 25, Sable) # Menton

# Museau (Style V1 - Large)
d(cx, cy+10, 18, Sable)
d(cx-12, cy+15, 14, Sable)
d(cx+12, cy+15, 14, Sable)

# Nez (Style V1 - Triangle)
d(cx, cy+5, 8, Nez)
d(cx-6, cy+2, 6, Nez)
d(cx+6, cy+2, 6, Nez)

# Bouche
for k in range(15): d(cx, cy+15+k, 1, Nez)

# Yeux (Style V1 - Ronds)
ey = 100
d(135, ey, 10, Sable)
d(185, ey, 10, Sable)
d(138, ey+2, 7, Blanc)
d(182, ey+2, 7, Blanc)
d(138, ey+2, 4, (200, 150, 0))
d(182, ey+2, 4, (200, 150, 0))
d(138, ey+2, 2, Noir)
d(182, ey+2, 2, Noir)
d(137, ey+1, 1, Blanc)
d(181, ey+1, 1, Blanc)

# Moustaches
for k in range(1, 25, 4):
  d(140-k, 125+k/3, 1, (50,50,50))
  d(140-k, 130+k/6, 1, (50,50,50))
  d(180+k, 125+k/3, 1, (50,50,50))
  d(180+k, 130+k/6, 1, (50,50,50))

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 cookies policy.