cb.py

Created by schraf

Created on December 29, 2021

751 Bytes

Depuis 2019 le logo est plus simple (pas de bandes à l’intersection), voici un exemple de code :

from kandinsky import *

RO, OR, ROR, WH = (252,9,17), (254,167,0), (254,105,0), (255,255,255)
R = 80 ** 2

for l in range(222):
    for c in range(320):
        rouge = (c - 100) ** 2 + (l - 111) ** 2 < R
        orange = (c - 216) ** 2 + (l - 111) ** 2 < R
        if rouge and orange: coul = ROR
        elif rouge: coul = RO
        elif orange: coul = OR   
        if orange or rouge: set_pixel(c,l,coul)


from kandinsky import *
from random import random

RO, OR, BL, WH = (227,13,5), (242,131,18), (3,13,86), (255,255,255)
R = 80 ** 2

# on parcourt tous les pixels
for l in range(222):
    for c in range(320):
        # Ds cercle rouge ? Orange ?
        rouge = (c - 96) ** 2 + (l - 111) ** 2 < R
        orange = (c - 220) ** 2 + (l - 111) ** 2 < R
        # si ds intersection, on alterne couleurs
        if rouge and orange: coul = RO if int(l // 7) % 2 == 0 or abs(l - 111) < 15 else OR
        elif rouge: coul = RO
        elif orange: coul = OR   
        # si exterieur, bleu
        else: coul = BL
        # Bandeau blanc
        if abs(c - 160) < 125 and abs(l - 114) < 16 and random() < .35: coul = WH
        set_pixel(c,l,coul)