-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
37 changed files
with
485 additions
and
1,435 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
fr-FR/code/powerful_patterns_art_deco_wallpaper_example/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from random import randint | ||
|
||
|
||
def motif(): | ||
global taille_cercle | ||
for i in range(5): | ||
ellipse(0, 0, taille_cercle / 5 * (5 - i), taille_cercle / 5 * (5 - i)) | ||
|
||
|
||
def setup(): | ||
size(400, 400) | ||
print('🖌 Cet art utilise beaucoup de cercles !') | ||
|
||
global taille_cercle | ||
|
||
taille_cercle = 50 | ||
|
||
|
||
def draw(): | ||
# Couleurs du motif | ||
stroke(40, 35, 100) # bleu | ||
stroke_weight(2) # bordure épaisse | ||
fill(200, 180, 128) # or | ||
|
||
translate(0, 0) # commencer en haut à gauche de l'écran | ||
|
||
if frame_count <= 16: # crée 16 lignes puis s'arrête | ||
for row in range(frame_count): # anime 1 ligne à la fois | ||
for shape in range(16): # créer une ligne de motifs | ||
motif() | ||
translate(taille_cercle / 2, 0) | ||
translate(-width, taille_cercle / 2) # descendre pour commencer à la ligne suivante | ||
|
||
|
||
run(frame_rate=3) |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_art_deco_wallpaper_example/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : exemple de papier peint Art déco" | ||
identifier: "art-deco-example" | ||
type: 'python' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from time import * | ||
|
||
# Basé sur l'incroyable art du gâteau géométrique malaisien : Kek lapis Sarawak | ||
|
||
|
||
def quadrant(): | ||
# Choisis des couleurs magnifiques pour les couches de gâteau | ||
turquoise = Color(64, 224, 208) | ||
or = Color(255, 215, 0) | ||
tomate = Color(255, 99, 71) | ||
|
||
# La confiture colle les couches ensemble | ||
confiture = Color(255, 165, 0) | ||
stroke(confiture) | ||
stroke_weight(2) # Change le nombre pour changer la quantité de confiture | ||
|
||
# Neuf couches de gâteau, en répétant les 3 couleurs 3 fois | ||
for i in range(3): | ||
debut_y = i * 60 # hauteur de 3 blocs de gâteau | ||
fill(turquoise) | ||
rect(0, debut_y, 180, 20) | ||
fill(or) | ||
rect(0, debut_y + 20, 180, 20) | ||
fill(tomate) | ||
rect(0, debut_y + 40, 180, 20) | ||
|
||
|
||
def externe(): | ||
# Le gâteau est enveloppé dans une couche extérieure | ||
jaunevert = Color(154, 205, 50) | ||
|
||
no_fill() # Ne couvre pas les quadrants du gâteau ! | ||
stroke(jaunevert) | ||
stroke_weight(20) | ||
rect(10, 10, 380, 380, 20) | ||
|
||
|
||
def setup(): | ||
size(400, 400) # faire le gâteau carré | ||
background(255, 255, 255, 0) # arrière-plan transparent | ||
|
||
|
||
def draw(): | ||
# Définis un quart de tour pour que notre code soit facile à lire | ||
quart = radians(90) | ||
|
||
translate(200, 200) # partir du centre | ||
|
||
# Faire le quart inférieur droit du gâteau puis faire pivoter pour les autres quarts | ||
|
||
if frame_count <= 4: # dessine jusqu'à 4 quadrants | ||
for i in range(frame_count): | ||
quadrant() | ||
rotate(quart) | ||
|
||
if frame_count == 5: # ajoute la couche externe | ||
translate(-200, -200) # retour au coin supérieur | ||
externe() # couche externe | ||
|
||
|
||
run(frame_rate=5) # 5 images par seconde |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_kek_lepis_sarawak/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : exemple de Kek Lepis Sarawak" | ||
identifier: "repeated-patterns-example" | ||
type: 'python' |
77 changes: 77 additions & 0 deletions
77
fr-FR/code/powerful_patterns_mcewen_tartan_example/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
|
||
|
||
def setup(): | ||
size(400, 400) | ||
|
||
|
||
def draw(): | ||
lignes = 10 * frame_count # Utiliser dans la forme largeur/longueur pour animer au fil du temps | ||
|
||
# Couleurs du tartan McEwen | ||
# Couleurs des carrés de base | ||
BLEU = Color(83, 143, 200) | ||
VERT = Color(78, 163, 162) | ||
COULEURS_BASE = [VERT, BLEU] | ||
|
||
# Couleurs des croix | ||
JAUNE = Color(155, 176, 135) | ||
ROUGE = Color(155, 129, 113) | ||
COULEURS_CROIX = [JAUNE, ROUGE] | ||
|
||
# Couleur de couture et de chevauchement | ||
GRIS = Color(78, 99, 86) | ||
|
||
# Dessiner tous les carrés de base alternés VERT et BLEU | ||
no_stroke() | ||
coordonnee_y = 0 | ||
carres = width/taille_carre | ||
|
||
for i in range(int(carres)): | ||
ecart = 0 | ||
for j in range(int(carres)): | ||
fill(COULEUR_BASE[j % 2]) # VERT et BLEU | ||
rect(ecart, coordonnee_y, taille_carre, taille_carre) | ||
ecart = ecart + taille_carre | ||
coordonnee_y = coordonnee_y + taille_carre | ||
|
||
# Croix | ||
stroke(GRIS) | ||
|
||
# Dessine des croix alternées JAUNE et ROUGE | ||
for i in range(4): | ||
fill(JAUNE) | ||
croix = taille_carre / 2 - 2 | ||
for i in range(int(carres/2)): | ||
fill(COULEURS_CROIX[i % 2]) # JAUNE et ROUGE | ||
rect(croix, 0, 4, lignes) | ||
rect(0, croix, lignes, 4) | ||
croix = croix + 2 * taille_croix | ||
# Dessine les croix de couture | ||
no_fill() | ||
croix = taille_carre + taille_carre / 2 - 2 | ||
for i in range(int(carres)): | ||
rect(croix, 0, 4, lignes) | ||
rect(0, croix, lignes, 4) | ||
croix = croix + taille_croix | ||
|
||
# Dessine les lignes grises où le matériau se chevauche | ||
no_stroke() | ||
fill(GRIS, 100) | ||
ecart = taille_carre - 4 | ||
for i in range(int(carres)): | ||
rect(ecart, 0, 8, lignes) | ||
ecart = ecart + taille_carre | ||
ecart = taille_carre - 4 | ||
for i in range(int(carres)): | ||
rect(0, ecart, lignes, 8) | ||
ecart = ecart + taille_carre | ||
|
||
|
||
print('🏴 Voici McEwen Tartan 🏴') | ||
taille_carrée = int( | ||
input('Quelle taille de tartan 🏴souhaites-tu ? 20, 50 ou 100')) | ||
|
||
run(frame_rate=10) |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_mcewen_tartan_example/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : le tartan McEwen" | ||
identifier: "mcewen-tartan-example" | ||
type: 'python' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from random import randint | ||
|
||
|
||
def dessin_motif(): | ||
orange = Color(191, 64, 191) | ||
brun = Color(200, 120, 0) | ||
vert = Color(100, 155, 0) | ||
fill(orange) | ||
ellipse(200, 200, 200, 190) | ||
fill(0) | ||
# Les yeux | ||
ellipse(160, 190, 30, 30) | ||
ellipse(240, 190, 30, 30) | ||
fill(255) | ||
ellipse(165, 200, 10, 10) | ||
ellipse(245, 200, 10, 10) | ||
# La bouche | ||
no_fill() | ||
stroke(255, 255, 255) | ||
ellipse(150, 250, 30, 30) | ||
ellipse(250, 250, 30, 30) | ||
fill(255, 255, 255) | ||
no_stroke() | ||
rect(150, 230, 100, 40) | ||
fill(108, 200, 206) | ||
rect(152, 235, 96, 30) | ||
|
||
|
||
def setup(): | ||
size(400, 400) | ||
background(255) | ||
no_stroke() | ||
|
||
|
||
def draw(): | ||
push_matrix() | ||
# décalé de la largeur d'un quart de taille du visage | ||
translate(randint(-50, 350), randint(-50, 350)) | ||
scale(0,25, 0,25) # chemins de quart de taille | ||
dessin_motif() | ||
pop_matrix() | ||
|
||
|
||
run(frame_rate=10) |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_random_faces_example/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : visages aléatoires" | ||
identifier: "random-faces-example" | ||
type: 'python' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from math import random | ||
from random import randint | ||
|
||
|
||
def motif(): | ||
fill(randint(0, 255), randint(0, 255), randint(0, 255)) | ||
ellipse(0, 0, 25, 25) | ||
fill(0, 0, 0) | ||
ellipse(0, 0, 15, 15) | ||
fill(randint(0, 255), randint(0, 255), randint(0, 255)) | ||
for i in range(4): # une courte rangée de carrés | ||
rect(i * 5, 0, 5, 5) | ||
|
||
|
||
def setup(): | ||
size(400, 400) | ||
stroke_weight(2) # bordure épaisse | ||
background(255) | ||
|
||
|
||
def draw(): | ||
translate(200, 200) # démarrer depuis le centre de l'écran | ||
if frame_count < 150: | ||
for i in range(frame_count): # anime le motif | ||
motif() | ||
rotate(5) # tourne le motif | ||
translate(i, i) # déplace le motif | ||
|
||
|
||
run(frame_rate=10) # animation rapide |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_spirals_example/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : spirales" | ||
identifier: "spirals-pattern-example" | ||
type: 'python' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from random import randint | ||
|
||
|
||
def setup(): | ||
# Mets le code à exécuter une fois ici | ||
size(400, 400) | ||
background(255, 255, 255) | ||
|
||
|
||
def draw(): | ||
# Mets le code à exécuter une fois ici | ||
fill(255, 0, 255) | ||
rect(50, 50, 120, 100) | ||
|
||
|
||
# Garde ceci pour exécuter ton code | ||
run(frame_rate=5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants" | ||
identifier: "powerful-patterns-starter" | ||
type: 'python' |
66 changes: 66 additions & 0 deletions
66
fr-FR/code/powerful_patterns_yakan_weaving_example/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/python3 | ||
|
||
from p5 import * | ||
from math import random | ||
|
||
|
||
def motif(): | ||
taille_motif = 100 | ||
|
||
# Couleurs du fil | ||
ORANGE = Color(254, 96, 1) | ||
VIOLET = Color(135, 18, 192) | ||
JAUNE = Color(243, 200, 19) | ||
BLEU = Color(83, 171, 176) | ||
|
||
# Carrés | ||
fill(ORANGE) | ||
rect(0, 0, taille_motif/2, taille_motif/2) | ||
fill(VIOLET) | ||
rect(50, 0, taille_motif/2, taille_motif/2) | ||
fill(JAUNE) | ||
rect(0, 50, taille_motif/2, taille_motif/2) | ||
fill(BLEU) | ||
rect(50, 50, taille_motif/2, taille_motif/2) | ||
fill(VIOLET) | ||
rect(0, 0, taille_motif/4, taille_motif/4) | ||
fill(ORANGE) | ||
rect(50, 0, taille_motif/4, taille_motif/4) | ||
fill(BLEU) | ||
rect(0, 50, taille_motif/4, taille_motif/4) | ||
fill(JAUNE) | ||
rect(50, 50, taille_motif/4, taille_motif/4) | ||
|
||
|
||
def rotation_motif(): | ||
for shape in range(5): # ligne de motifs | ||
push_matrix() # enregistrer les paramètres | ||
rotate(radians(45)) # tourner la forme de 45 degrés | ||
motif() | ||
pop_matrix() # retourne aux paramètres enregistrés | ||
translate(largeur_motif, 0) # se déplacer horizontalement | ||
|
||
|
||
def setup(): | ||
size(400, 400) | ||
background(250, 5, 94) # rose | ||
no_stroke() | ||
print('C\'est le 🇵🇭 tissage Yakan') | ||
|
||
|
||
def draw(): | ||
global largeur_motif | ||
largeur_motif = 150 | ||
|
||
translate(-largeur_motif/2, -largeur_motif/2) # pour commencer avec des demi-motifs | ||
|
||
si frame_count < 20: # nombre maximum de lignes | ||
for row in range(frame_count): | ||
rotation_motif() | ||
if row / 2 == 0: # pour décaler le motif sur la ligne suivante | ||
translate(-largeur_motif * 5 + 75, 80) | ||
else: | ||
translate(-largeur_motif * 5 - 75, 80) | ||
|
||
|
||
run(frame_rate=3) |
3 changes: 3 additions & 0 deletions
3
fr-FR/code/powerful_patterns_yakan_weaving_example/project_config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: "Motifs puissants : le tissage Yakan" | ||
identifier: "yakan-weaving-example" | ||
type: 'python' |
Oops, something went wrong.