diff --git a/fr-FR/code/powerful_patterns_kek_lepis_sarawak/project_config.yml b/fr-FR/code/powerful_patterns_kek_lepis_sarawak/project_config.yml index 976ccbc2..67a2ce12 100644 --- a/fr-FR/code/powerful_patterns_kek_lepis_sarawak/project_config.yml +++ b/fr-FR/code/powerful_patterns_kek_lepis_sarawak/project_config.yml @@ -1,3 +1,3 @@ name: "Motifs puissants : exemple de Kek Lepis Sarawak" identifier: "repeated-patterns-example" -type: 'python' \ No newline at end of file +type: 'python' diff --git a/fr-FR/code/powerful_patterns_mcewen_tartan_example/main.py b/fr-FR/code/powerful_patterns_mcewen_tartan_example/main.py index 41e393a7..b08fdae2 100644 --- a/fr-FR/code/powerful_patterns_mcewen_tartan_example/main.py +++ b/fr-FR/code/powerful_patterns_mcewen_tartan_example/main.py @@ -31,7 +31,7 @@ def draw(): for i in range(int(carres)): ecart = 0 - for j in range(int(carres)): + for i in range(int(carres)): fill(COULEURS_BASE[j % 2]) # VERT et BLEU rect(ecart, coordonnee_y, taille_carre, taille_carre) ecart = ecart + taille_carre @@ -48,14 +48,14 @@ def draw(): fill(COULEURS_CROIX[i % 2]) # JAUNE et ROUGE rect(croix, 0, 4, lignes) rect(0, croix, lignes, 4) - croix = croix + 2 * taille_carre + 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_carre + croix = croix + taille_croix # Dessine les lignes grises où le matériau se chevauche no_stroke() diff --git a/fr-FR/code/powerful_patterns_random_faces_example/main.py b/fr-FR/code/powerful_patterns_random_faces_example/main.py index 4791ea20..b146f813 100644 --- a/fr-FR/code/powerful_patterns_random_faces_example/main.py +++ b/fr-FR/code/powerful_patterns_random_faces_example/main.py @@ -39,7 +39,7 @@ 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 + scale(0.5, 0.25) # chemins de quart de taille dessin_motif() pop_matrix() diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml index e7986b18..3261ca92 100644 --- a/fr-FR/meta.yml +++ b/fr-FR/meta.yml @@ -2,8 +2,8 @@ title: Motifs puissants hero_image: images/banner.png description: - - Créer une œuvre d'art inspirante qui peut être mise à l'échelle en utilisant des motifs - - répétés + Crée une œuvre d'art inspirante qui peut être mise à l'échelle en utilisant + des motifs répétés meta_title: Projets de codage Python pour enfants et adolescents | Motifs puissants meta_description: Apprends Python avec les projets de codage de la Raspberry Pi Foundation pour les enfants et les adolescents. Crée une œuvre d'art inspirante avec Python en utilisant des motifs répétés. version: 4 @@ -12,16 +12,15 @@ copyedit: true last_tested: "2021-10-06" steps: - title: Ce que tu vas faire - - title: Ton idée - - title: 'Construire et tester : motif' + - title: Commencer completion: - engaged - - title: 'Développer et tester : motif' + - title: Créer un motif completion: - internal - - title: Liste de contrôle + - title: Faire le motif completion: - external - - title: Améliorer ton projet - - title: Partager - - title: Et ensuite ? + - title: Défi + challenge: true + - title: Que peux-tu faire maintenant ? diff --git a/fr-FR/python-comments.txt b/fr-FR/python-comments.txt index 9e74be4a..0c76dbae 100644 --- a/fr-FR/python-comments.txt +++ b/fr-FR/python-comments.txt @@ -2,150 +2,8 @@ Choisis une taille Essaie différents nombres pour changer la couleur -Commencer la transformation - -Réinitialiser la transformation - Moitié de la taille -Mettre le code à exécuter ci-dessous - -Mettre le code pour exécuter chaque image ici - -Garde ceci pour exécuter ton code - -Choisis des couleurs magnifiques pour les couches de gâteau - -La confiture colle les couches ensemble - -Change le nombre pour changer la quantité de confiture - -Neuf couches de gâteau, en répétant les 3 couleurs 3 fois - -hauteur de 3 blocs de gâteau - -Le gâteau est enveloppé dans une couche extérieure - -Ne couvre pas les quadrants du gâteau ! - -rendre le gâteau carré - -arrière-plan transparent - -5 images par seconde - -Définis un quart de tour pour que notre code soit facile à lire - -commencer à partir du centre - -Faire le quart inférieur droit du gâteau puis faire pivoter pour les autres quarts - -dessiner jusqu'à 4 quadrants - -ajouter la couche externe - -retour au coin supérieur - -couche externe - -Définitions pour la compatibilité avec la bibliothèque de traitement p5py - -Forme - -Polices - -Texte - -Couleur - -Images - -Environnement - -Transformation - -Clavier - -une courte rangée de carrés - -animation rapide - -bordure épaisse - -commencer à partir du centre de l'écran - -anime le motif - -tourne le motif - -déplace le motif - -Yeux - -Bouche - -décalé de la largeur d'un quart de taille du visage - -chemins quart de taille - -Couleurs du motif - -bleu - -doré - -commencer en haut à gauche de l'écran - -créer 16 lignes puis s'arrêter - -anime 1 ligne à la fois - -créer une ligne de motifs - -descendre pour commencer la ligne suivante - -Couleurs du fil - -Carrés - -ligne de formes - -enregistrer les paramètres - -tourner la forme de 45 degrés - -revenir aux paramètres enregistrés - -déplacer horizontalement - -rose - -commencer par des demi-motifs - -lignes maximales - -pour décaler le motif sur la ligne suivante - -Utiliser dans la largeur/longueur de la forme pour animer au fil du temps - -Couleurs du tartan McEwen - -Couleurs des carrés de base - -Couleurs des croix - -Couleur de couture et de chevauchement - -Dessine tous les carrés de base alternés VERT et BLEU - -VERT et BLEU - -Croix - -Dessine des croix alternées JAUNE et ROUGE - -JAUNE et ROUGE - -Dessine les croix de couture +Commencer la transformation -Dessine les lignes grises où le matériau se chevauche +Réinitialiser la transformation \ No newline at end of file diff --git a/fr-FR/python-translatable.txt b/fr-FR/python-translatable.txt index 0b0af7e3..b2a454cf 100644 --- a/fr-FR/python-translatable.txt +++ b/fr-FR/python-translatable.txt @@ -1,71 +1,3 @@ -quadrant - -turquoise - -doré - -tomate - -confiture - -debut_y - -exterieur - -vertjaune - -quartier - -motif - dessin_motif -orange - -brun - -vert - -taille_cercle - -Cet art utilise beaucoup de cercles ! - -taille_motif - -ORANGE - -VIOLET - -JAUNE - -BLEU - -C'est le tissage philippin Yakan - -largeur_motif - -C'est le tartan McEwen - -taille_carré - -Quelle taille de tartan souhaites-tu ? 20, 50 ou 100 - -lignes - -VERT - -COULEURS_BASE - -ROUGE - -COULEURS_CROIX - -GRIS - -coordonnee_y - -carrés - -écart - -croix +BLEU \ No newline at end of file diff --git a/fr-FR/resources/art_deco.py b/fr-FR/resources/art_deco.py new file mode 100644 index 00000000..cfc6201e --- /dev/null +++ b/fr-FR/resources/art_deco.py @@ -0,0 +1,37 @@ +#!/bin/python3 + +from p5 import * +from math import random +from random import randint + +def motif(): + global circle_size + for i in range(5): + ellipse(0, 0, circle_size / 5 * (5 - i), circle_size / 5 * (5 - i)) + +def setup(): + size(400, 400) + frame_rate(3) + print('🖌 This art uses lots of circles!') + + global circle_size + + circle_size = 50 + +def draw(): + + # Pattern colours + stroke(40, 35, 100) # blue + stroke_weight(2) # thick border + fill(200, 180, 128) # gold + + translate(0,0) # start from the top left of the screen + + if frame_count <= 16: # creates 16 rows then stops + for row in range (frame_count): # animates 1 row at a time + for shape in range (16): # create a row of motifs + motif() + translate(circle_size / 2, 0) + translate(-width, circle_size / 2) # move down to start next row + +run() \ No newline at end of file diff --git a/fr-FR/resources/draw_kek_lapis_sarawak.py b/fr-FR/resources/draw_kek_lapis_sarawak.py new file mode 100644 index 00000000..edb0e21b --- /dev/null +++ b/fr-FR/resources/draw_kek_lapis_sarawak.py @@ -0,0 +1,134 @@ +# Definitions for compatibility with the p5py processing library +from processing import * +import __main__ + +# Shape +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Fonts +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Text +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Colour +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environment +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transform +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Keyboard + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() diff --git a/fr-FR/resources/face_mask.py b/fr-FR/resources/face_mask.py new file mode 100644 index 00000000..1a7358c7 --- /dev/null +++ b/fr-FR/resources/face_mask.py @@ -0,0 +1,46 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def draw_motif(): + orange = color(191, 64, 191) + brown = color(200, 120, 0) + green = color(100, 155, 0) + fill(orange) + ellipse(200, 200, 200, 190) + fill(0) + # Eyes + ellipse(160, 190, 30, 30) + ellipse(240, 190, 30, 30) + fill(255) + ellipse(165, 200, 10, 10) + ellipse(245, 200, 10, 10) + # Mouth + noFill() + stroke(255, 255, 255) + ellipse(150, 250, 30, 30) + ellipse(250, 250, 30, 30) + fill(255, 255, 255) + noStroke() + rect(150, 230, 100, 40) + fill(108, 200, 206) + rect(152, 235, 96, 30) + + +def setup(): + size(400, 400) + background(255) + no_stroke() + frame_rate(10) + + +def draw(): + push_matrix() + translate(randint(-50, 350), randint(-50, 350)) # offset by the width of the quarter-size face + scale(0.25) # quarter size paths + draw_motif() + pop_matrix() + + +run() \ No newline at end of file diff --git a/fr-FR/resources/fibonacci.py b/fr-FR/resources/fibonacci.py new file mode 100644 index 00000000..7a66f671 --- /dev/null +++ b/fr-FR/resources/fibonacci.py @@ -0,0 +1,43 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def setup(): + size(800, 800) + frame_rate(2) + stroke_weight(2) + background(255) + ellipseMode(CORNER) + +def draw(): + + BLUE = color(0, 0, 255) + BLACK = color(0, 0, 0) + translate(width/2, height/2) + + # Motif + rect(0, 0, 1, 1) + arc(0, 0, 1, 1, radians(90), radians(180)) + translate(1,1) + rotate(radians(270)) + + first = 0 + second = 1 + next = first + second + + # Pattern + if frame_count < 20: + for i in range (frame_count): + stroke(BLACK) + rect(0, 0, next, next) + no_fill() + stroke(BLUE) + arc(0, -next, next*2, next*2, radians(90), radians(180)) + translate(next,next) + rotate(radians(270)) + first = second + second = next + next = first + second + +run() \ No newline at end of file diff --git a/fr-FR/resources/kek_lapis_sarawak.py b/fr-FR/resources/kek_lapis_sarawak.py new file mode 100644 index 00000000..4dc73554 --- /dev/null +++ b/fr-FR/resources/kek_lapis_sarawak.py @@ -0,0 +1,67 @@ +#!/bin/python3 + +from draw import * +from time import * + +# Based on the amazing Malaysian geometric cake art: Kek lapis Sarawak + +def quadrant(): + + # Choose some gorgeous colours for the cake layers + turquoise = color(64, 224, 208) + gold = color(255, 215, 0) + tomato = color(255, 99, 71) + + # Jam sticks the layers together + jam = color(255, 165, 0) + stroke(jam) + stroke_weight(2) # Change the number to change the amount of jam + + # Nine layers of cake, repeating the 3 colours 3 times + for i in range(3): + start_y = i * 60 # height of 3 blocks of cake + fill(turquoise) + rect(0, start_y, 180, 20) + fill(gold) + rect(0, start_y + 20, 180, 20) + fill(tomato) + rect(0, start_y + 40, 180, 20) + + +def outer(): + + # Thehe cake is wrapped in an outer layer + yellowgreen = Color(154, 205, 50) + + no_fill() # Don't cover up the cake quadrants! + stroke(yellowgreen) + stroke_weight(20) + rect(10, 10, 380, 380, 20) + + +def setup(): + size(400, 400) # make the cake square + background(255, 255, 255, 0) # transparent background + frame_rate(5) # 5 frames per second + + +def draw(): + + # Define a quarter turn so our code is easy to read + quarter = radians(90) + + translate(200, 200) # start from the center + + # Make the bottom right quarter of the cake then rotate for the other quarters + + if frame_count <= 4: # draw up to 4 quadrants + for i in range(frame_count): + quadrant() + rotate(quarter) + + if frame_count == 5: # add the outer layer + translate(-200, -200) # back to the top corner + outer() # outer layer + + +run() diff --git a/fr-FR/resources/mcewen.py b/fr-FR/resources/mcewen.py new file mode 100644 index 00000000..b107f3fc --- /dev/null +++ b/fr-FR/resources/mcewen.py @@ -0,0 +1,79 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + frame_rate(10) + print('🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁢󠁳󠁣󠁴󠁿 This is McEwen Tartan 🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁧󠁢󠁳󠁣󠁴󠁿') + + global square_size + square_size = int(input('What size 🏴󠁧󠁢󠁳󠁣󠁴󠁿tartan would you like? 20, 50, or 100')) + +def draw(): + + lines = 10 * frame_count # Use in shape width/length to animate over time + + # McEwen tartan colours + # Base square colours + BLUE = color(83, 143, 200) + GREEN = color(78, 163, 162) + BASE_COLORS = [GREEN, BLUE] + + # Cross colours + YELLOW = color(155, 176, 135) + RED = color(155, 129, 113) + CROSS_COLORS = [YELLOW, RED] + + # Stitching and overlap colour + GREY = color(78, 99, 86) + + # Draw all the GREEN and BLUE alternating Base squares + no_stroke() + y_coordinate = 0 + squares = width/square_size + + for i in range (int(squares)): + gap = 0 + for j in range (int(squares)): + fill(BASE_COLORS[j % 2]) # GREEN and BLUE + rect(gap, y_coordinate, square_size, square_size) + gap = gap + square_size + y_coordinate = y_coordinate + square_size + + # Crosses + stroke(GREY) + + # DRAW THE YELLOW and RED alternating crosses + for i in range (4): + fill(YELLOW) + cross = square_size / 2 - 2 + for i in range (int(squares/2)): + fill(CROSS_COLORS[i % 2]) # YELLOW and RED + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + 2 * square_size + # Draw the stiching crosses + no_fill() + cross = square_size + square_size / 2 - 2 + for i in range (int(squares)): + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + square_size + + # Draw the grey lines where material overlaps + no_stroke() + fill(GREY, 100) + gap = square_size - 4 + for i in range (int(squares)): + rect(gap, 0, 8, lines) + gap = gap + square_size + gap = square_size - 4 + for i in range (int(squares)): + rect(0, gap, lines, 8) + gap = gap + square_size + +run() + + + diff --git a/fr-FR/solutions/Spirals.zip b/fr-FR/resources/p5_art_deco.py similarity index 77% rename from fr-FR/solutions/Spirals.zip rename to fr-FR/resources/p5_art_deco.py index d25ab451..fc023ee6 100644 Binary files a/fr-FR/solutions/Spirals.zip and b/fr-FR/resources/p5_art_deco.py differ diff --git a/uk-UA/solutions/Spirals.zip b/fr-FR/resources/p5_face_mask.py similarity index 77% rename from uk-UA/solutions/Spirals.zip rename to fr-FR/resources/p5_face_mask.py index d25ab451..fc023ee6 100644 Binary files a/uk-UA/solutions/Spirals.zip and b/fr-FR/resources/p5_face_mask.py differ diff --git a/nl-NL/solutions/Spirals.zip b/fr-FR/resources/p5_fibonacci.py similarity index 77% rename from nl-NL/solutions/Spirals.zip rename to fr-FR/resources/p5_fibonacci.py index d25ab451..fc023ee6 100644 Binary files a/nl-NL/solutions/Spirals.zip and b/fr-FR/resources/p5_fibonacci.py differ diff --git a/fr-FR/solutions/Fibonacci-sequence.zip b/fr-FR/resources/p5_mcewen.py similarity index 76% rename from fr-FR/solutions/Fibonacci-sequence.zip rename to fr-FR/resources/p5_mcewen.py index 96509ea8..fc023ee6 100644 Binary files a/fr-FR/solutions/Fibonacci-sequence.zip and b/fr-FR/resources/p5_mcewen.py differ diff --git a/fr-FR/resources/p5_spirals.py b/fr-FR/resources/p5_spirals.py new file mode 100644 index 00000000..fc023ee6 --- /dev/null +++ b/fr-FR/resources/p5_spirals.py @@ -0,0 +1,135 @@ +# Definitions for compatibility with the p5py processing library +from processing import * +import __main__ + +# Shape +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Fonts +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Text +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Colour +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environment +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transform +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Keyboard + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/resources/p5_yakan_weaving.py b/fr-FR/resources/p5_yakan_weaving.py new file mode 100644 index 00000000..fc023ee6 --- /dev/null +++ b/fr-FR/resources/p5_yakan_weaving.py @@ -0,0 +1,135 @@ +# Definitions for compatibility with the p5py processing library +from processing import * +import __main__ + +# Shape +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Fonts +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Text +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Colour +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environment +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transform +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Keyboard + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/resources/spirals.py b/fr-FR/resources/spirals.py new file mode 100644 index 00000000..4e455676 --- /dev/null +++ b/fr-FR/resources/spirals.py @@ -0,0 +1,30 @@ +#!/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): # a short row of squares + rect(i * 5, 0, 5, 5) + +def setup(): + size(400, 400) + frame_rate(10) # fast animation + stroke_weight(2) # thick border + background(255) + +def draw(): + translate(200, 200) # start from the centre of the screen + if frame_count < 150: + for i in range(frame_count): # animates the pattern + motif() + rotate(5) # turns the motif + translate(i,i) # moves the motif + +run() \ No newline at end of file diff --git a/fr-FR/resources/yakan_weaving.py b/fr-FR/resources/yakan_weaving.py new file mode 100644 index 00000000..a350a8c1 --- /dev/null +++ b/fr-FR/resources/yakan_weaving.py @@ -0,0 +1,64 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def motif(): + motif_size = 100 + + #Thread colours + ORANGE = color(254, 96, 1) + PURPLE = color(135, 18, 192) + YELLOW = color(243, 200, 19) + BLUE = color(83, 171, 176) + + # Squares + fill(ORANGE) + rect(0, 0, motif_size/2, motif_size/2) + fill(PURPLE) + rect(50, 0, motif_size/2, motif_size/2) + fill(YELLOW) + rect(0, 50, motif_size/2, motif_size/2) + fill(BLUE) + rect(50, 50, motif_size/2, motif_size/2) + fill(PURPLE) + rect(0, 0, motif_size/4, motif_size/4) + fill(ORANGE) + rect(50, 0, motif_size/4, motif_size/4) + fill(BLUE) + rect(0, 50, motif_size/4, motif_size/4) + fill(YELLOW) + rect(50, 50, motif_size/4, motif_size/4) + +def rotate_motif(): + + for shape in range(5): # row of shapes + pushMatrix() # save settings + rotate(radians(45)) # turn shape 45 degrees + motif() + popMatrix() # go back to saved settings + translate(motif_width, 0) # move horizontally + +def setup(): + size(400, 400) + frame_rate(3) + background(250, 5, 94) # pink + no_stroke() + print('This is 🇵🇭 Yakan weaving ') + +def draw(): + + global motif_width + motif_width = 150 + + translate(-motif_width/2, -motif_width/2) # to start with half motifs + + if frame_count < 20: # maximum rows + for row in range(frame_count): + rotate_motif() + if row / 2 == 0: # to offset pattern on next row + translate(-motif_width * 5 + 75, 80) + else: + translate(-motif_width * 5 - 75, 80) + +run() diff --git a/fr-FR/solutions/.keep b/fr-FR/solutions/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/fr-FR/solutions/Art deco wallpaper.zip b/fr-FR/solutions/Art deco wallpaper.zip deleted file mode 100644 index 0e3cc9e5..00000000 Binary files a/fr-FR/solutions/Art deco wallpaper.zip and /dev/null differ diff --git a/fr-FR/solutions/Art deco wallpaper/main.py b/fr-FR/solutions/Art deco wallpaper/main.py new file mode 100644 index 00000000..143641d4 --- /dev/null +++ b/fr-FR/solutions/Art deco wallpaper/main.py @@ -0,0 +1,37 @@ +#!/bin/python3 + +from p5 import * +from math import random +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) + frame_rate(3) + 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() \ No newline at end of file diff --git a/fr-FR/solutions/Art deco wallpaper/p5.py b/fr-FR/solutions/Art deco wallpaper/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/Art deco wallpaper/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/solutions/Face mask pattern.zip b/fr-FR/solutions/Face mask pattern.zip deleted file mode 100644 index bd9fbc8b..00000000 Binary files a/fr-FR/solutions/Face mask pattern.zip and /dev/null differ diff --git a/fr-FR/solutions/Face mask pattern/main.py b/fr-FR/solutions/Face mask pattern/main.py new file mode 100644 index 00000000..3ffdc101 --- /dev/null +++ b/fr-FR/solutions/Face mask pattern/main.py @@ -0,0 +1,46 @@ +#!/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 + noFill() + stroke(255, 255, 255) + ellipse(150, 250, 30, 30) + ellipse(250, 250, 30, 30) + fill(255, 255, 255) + noStroke() + rect(150, 230, 100, 40) + fill(108, 200, 206) + rect(152, 235, 96, 30) + + +def setup(): + size(400, 400) + background(255) + no_stroke() + frame_rate(10) + + +def draw(): + push_matrix() + translate(randint(-50, 350), randint(-50, 350)) # décalé de la largeur du quart de la face + scale(0.25) # chemins de quart de cercle + dessin_motif() + pop_matrix() + + +run() \ No newline at end of file diff --git a/fr-FR/solutions/Face mask pattern/p5.py b/fr-FR/solutions/Face mask pattern/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/Face mask pattern/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/solutions/Fibonacci-sequence/main.py b/fr-FR/solutions/Fibonacci-sequence/main.py new file mode 100644 index 00000000..731ba1ad --- /dev/null +++ b/fr-FR/solutions/Fibonacci-sequence/main.py @@ -0,0 +1,43 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def setup(): + size(800, 800) + frame_rate(2) + stroke_weight(2) + background(255) + ellipseMode(CORNER) + +def draw(): + + BLEU = color(0, 0, 255) + NOIR = color(0, 0, 0) + translate(width/2, height/2) + + # Motif + rect(0, 0, 1, 1) + arc(0, 0, 1, 1, radians(90), radians(180)) + translate(1,1) + rotate(radians(270)) + + premier = 0 + deuxieme = 1 + suivant = premier + deuxieme + + # Motif + if frame_count < 20: + for i in range (frame_count): + stroke(NOIR) + rect(0, 0, suivant, suivant) + no_fill() + stroke(BLEU) + arc(0, -suivant, suivant*2, suivant*2, radians(90), radians(180)) + translate(suivant,suivant) + rotate(radians(270)) + premier = deuxieme + deuxieme = suivant + suivant = premier + deuxieme + +run() \ No newline at end of file diff --git a/fr-FR/solutions/Fibonacci-sequence/p5.py b/fr-FR/solutions/Fibonacci-sequence/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/Fibonacci-sequence/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/solutions/Kek lapis Sarawak.zip b/fr-FR/solutions/Kek lapis Sarawak.zip deleted file mode 100644 index 951d1aba..00000000 Binary files a/fr-FR/solutions/Kek lapis Sarawak.zip and /dev/null differ diff --git a/fr-FR/solutions/Kek lapis Sarawak/draw.py b/fr-FR/solutions/Kek lapis Sarawak/draw.py new file mode 100644 index 00000000..00b11228 --- /dev/null +++ b/fr-FR/solutions/Kek lapis Sarawak/draw.py @@ -0,0 +1,134 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() diff --git a/fr-FR/solutions/Kek lapis Sarawak/main.py b/fr-FR/solutions/Kek lapis Sarawak/main.py new file mode 100644 index 00000000..8e340e03 --- /dev/null +++ b/fr-FR/solutions/Kek lapis Sarawak/main.py @@ -0,0 +1,67 @@ +#!/bin/python3 + +from draw 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) # Modifie 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) # rendre le gâteau carré + background(255, 255, 255, 0) # arrière-plan transparent + frame_rate(5) # 5 images par seconde + + +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() diff --git a/fr-FR/solutions/McEwen tartan.zip b/fr-FR/solutions/McEwen tartan.zip deleted file mode 100644 index 3e88394e..00000000 Binary files a/fr-FR/solutions/McEwen tartan.zip and /dev/null differ diff --git a/fr-FR/solutions/McEwen tartan/main.py b/fr-FR/solutions/McEwen tartan/main.py new file mode 100644 index 00000000..cde5cb05 --- /dev/null +++ b/fr-FR/solutions/McEwen tartan/main.py @@ -0,0 +1,79 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + frame_rate(10) + print('🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁢󠁳󠁣󠁴󠁿 Voici McEwen Tartan 🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁧󠁢󠁳󠁣󠁴󠁿') + + global taille_carre + taille_carre = int(input('Quelle taille de 🏴󠁧󠁢󠁳󠁣󠁴󠁿tartan souhaites-tu ? 20, 50 ou 100')) + +def draw(): + + lignes = 10 * frame_count # Utiliser la largeur/longueur de la forme pour animer dans le 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(COULEURS_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 + +run() + + + diff --git a/fr-FR/solutions/McEwen tartan/p5.py b/fr-FR/solutions/McEwen tartan/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/McEwen tartan/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/solutions/Spirals/main.py b/fr-FR/solutions/Spirals/main.py new file mode 100644 index 00000000..b19875b8 --- /dev/null +++ b/fr-FR/solutions/Spirals/main.py @@ -0,0 +1,30 @@ +#!/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) + frame_rate(10) # animation rapide + 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() \ No newline at end of file diff --git a/fr-FR/solutions/Spirals/p5.py b/fr-FR/solutions/Spirals/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/Spirals/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/solutions/Yakan Weaving.zip b/fr-FR/solutions/Yakan Weaving.zip deleted file mode 100644 index ab823312..00000000 Binary files a/fr-FR/solutions/Yakan Weaving.zip and /dev/null differ diff --git a/fr-FR/solutions/Yakan Weaving/main.py b/fr-FR/solutions/Yakan Weaving/main.py new file mode 100644 index 00000000..b6ce5c3d --- /dev/null +++ b/fr-FR/solutions/Yakan Weaving/main.py @@ -0,0 +1,64 @@ +#!/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 formes + pushMatrix() # enregistrer les paramètres + rotate(radians(45)) # tourner la forme de 45 degrés + motif() + popMatrix() # retourne aux paramètres enregistrés + translate(largeur_motif, 0) # se déplacer horizontalement + +def setup(): + size(400, 400) + frame_rate(3) + 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 + + if 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() diff --git a/fr-FR/solutions/Yakan Weaving/p5.py b/fr-FR/solutions/Yakan Weaving/p5.py new file mode 100644 index 00000000..e078ccd5 --- /dev/null +++ b/fr-FR/solutions/Yakan Weaving/p5.py @@ -0,0 +1,135 @@ +# Définitions pour la compatibilité avec la bibliothèque de traitement p5py +from processing import * +import __main__ + +# Forme +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Polices +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Texte +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Couleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Images +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Environnement +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Transformer +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Clavier + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md index 21a62510..aca51db1 100644 --- a/fr-FR/step_1.md +++ b/fr-FR/step_1.md @@ -1,104 +1,26 @@ -## Ce que tu vas faire -Créer une œuvre d'art inspirante qui peut être mise à l'échelle en utilisant des motifs répétés. - -Ton motif puissant devra répondre à la **fiche projet**. - -

-Une fiche projet décrit ce qu'un projet doit faire. C'est un peu comme se voir confier une mission à accomplir. -

- -Tu vas devoir : -+ Dessiner et positionner des formes géométriques pour créer un motif de base (ou « motif ») -+ Utiliser des boucles `for` pour `translater` le motif pour remplir l'écran -+ Utiliser les `frame_rate` et `frame_count` pour animer la création du motif - -

Les motifs sont partout autour de nous, dans les textiles, la nature, l'art, les traditions et le design. Le point de départ d'un motif est appelé un motif, qui est un élément qui peut être répété et agencé afin de créer de nombreux motifs différents. -

+Créer une œuvre d’art en utilisant des motifs répétés. --- no-print --- -### Joue ▶️ - ---- task --- - -
-
- -Clique sur le bouton **Run** ci-dessous pour voir cet exemple et réfléchir au motif répété. Comment décrirais-tu ce qui se passe dans l'animation ? -**Kek lapis Sarawak** : -
-
- -Tu peux trouver le projet Kek lapis Sarawak [ici](https://editor.raspberrypi.org/fr-FR/projects/repeated-patterns-example){:target="_blank"} ---- /task --- - -
- -### FICHE PROJET : Créer un **motif puissant** -
- -Ton motif puissant doit : -+ Dessiner et positionner des formes géométriques pour créer un motif de base -+ Utiliser des boucles pour répéter le motif afin de remplir l'écran -+ Animer la façon dont le motif est créé - -Ton motif puissant pourrait : -+ Utiliser des couleurs vives ou significatives -+ S'inspirer de ta culture ou de la culture populaire -+ Obtenir l'avis de l'utilisateur pour redimensionner le motif -+ Ajouter du texte et des emoji pour imprimer des détails sur ton art -+ Traduire le motif pour créer des variations -
- -### Trouver des idées 💭 - ---- task --- - -Exécute ces exemples de projets pour obtenir des idées pour ton motif. - -Comment les motifs ont-ils été réalisés à partir de cercles, d'ellipses, de carrés, de rectangles et de triangles ? : - -**Spirales** : - -Tu peux trouver le projet Spirales [ici](https://editor.raspberrypi.org/fr-FR/projects/spirals-pattern-example){:target="_blank"} - -**Visages aléatoires** : - -Tu peux trouver le projet Visages aléatoires [ici](https://editor.raspberrypi.org/fr-FR/projects/random-faces-example){:target="_blank"} - -**Papier peint art déco** : - -Tu peux trouver le projet Art déco [ici](https://editor.raspberrypi.org/fr-FR/projects/art-deco-example){:target="_blank"} - -**Tissage Yakan** : - -Tu peux trouver le projet de tissage Yakan [ici](https://editor.raspberrypi.org/fr-FR/projects/yakan-weaving-example){:target="_blank"} - ---- /task --- --- /no-print --- --- print-only --- -Regarde ces exemples et pense au motif répété. Comment les motifs ont-ils été réalisés à partir de cercles, d'ellipses, de carrés, de rectangles et de triangles ? +[Spirales](https://editor.raspberrypi.org/fr-FR/projects/spirals-pattern-example) +![Projet terminé Spirales.](images/spirals.png) + +[Visages aléatoires](https://editor.raspberrypi.org/fr-FR/projects/random-faces-example) +![Projet terminé Visages aléatoires.](images/random_faces.png) + +[Art déco](https://editor.raspberrypi.org/fr-FR/projects/art-deco-example) +![Projet terminé Art déco.](images/art_deco.png) -![Terminer le projet Kek lapis Sarawak.](images/kek.png) -Tu peux trouver le projet Kek lapis Sarawak ici https://editor.raspberrypi.org/fr-FR/projects/repeated-patterns-example -![Terminer le projet Spirales.](images/spirals.png) -Tu peux trouver le projet Spirales ici https://editor.raspberrypi.org/fr-FR/projects/spirals-pattern-example -![Terminer le projet Visages aléatoires.](images/random_faces.png) -Tu peux trouver le projet Visages aléatoires ici https://editor.raspberrypi.org/fr-FR/projects/random-faces-example -![Terminer le projet Art deco.](images/art_deco.png) -Tu peux trouver le projet Art déco ici https://editor.raspberrypi.org/fr-FR/projects/art-exemple-deco -![Terminer le projet de tissage Yakan.](images/yakan.png) -Tu peux retrouver le projet de tissage Yakan ici https://editor.raspberrypi.org/fr-FR/projects/yakan-weaving-example +[Tissage Yakan](https://editor.raspberrypi.org/fr-FR/projects/yakan-weaving-example) +![Projet terminé Tissage Yakan.](images/yakan.png) --- /print-only --- diff --git a/fr-FR/step_2.md b/fr-FR/step_2.md index 1d1ba63e..3d64d863 100644 --- a/fr-FR/step_2.md +++ b/fr-FR/step_2.md @@ -1,50 +1,8 @@ -## Ton idée - -Utilise cette étape pour planifier ton motif puissant. Tu peux planifier simplement en pensant, en bricolant, en dessinant ou en écrivant, ou comme bon te semble ! - -![Un gif animé de trois exemples différents utilisant différentes formes pour créer les motifs et les animations pour développer le motif.](images/ideas-1.gif) - -

Les motifs ont souvent une signification culturelle ou religieuse. Certaines formes et positions géométriques peuvent avoir des significations symboliques ou sacrées. Que le motif soit dans l'architecture, le tissu, l'art, la cuisine ou autre chose, le processus de fabrication du motif peut également être important.

- -### Pourquoi fais-tu ton modèle puissant ? +## Commencer --- task --- -Réfléchis à l'objectif du motif que tu crées. - -Ça pourrait être : -- Pour exprimer quelque chose d'important de ta culture ou de celle de ta famille -- Pour recréer un motif géométrique qui signifie quelque chose pour toi -- Quelque chose que tu crées avec un groupe de personnes pour envoyer un certain message (par exemple, un quilt) -- Pour montrer quelque chose de fascinant à propos d'un passe-temps (par exemple, l'art, la science, la nature, la musique) - -**Astuce :** les motifs sont partout ! Tu peux choisir de t'inspirer en partant à la recherche de modèles dans ton environnement physique ou en ligne. - ---- /task --- - -

En plus d'avoir une signification symbolique, les motifs illustrent les mathématiques qui nous entourent. Les mathématiques nous aident à donner un sens au monde qui nous entoure et nous pouvons trouver des modèles mathématiques dans l'art, la littérature et la nature.

- -### À qui s'adresse-t-il ? - ---- task --- - -Pense pour qui tu feras ton modèle (ton **public**). - -Quelle est la signification de ton motif ? Les couleurs, les formes ou la façon dont le motif est répété signifieront-elles quelque chose de spécial pour toi ou ton public ? - -Partager ton motif est un excellent moyen d'exprimer quelque chose sur toi-même ou sur ta culture. - -Si tu crées un motif en groupe, ton motif doit-il avoir une certaine taille ou forme pour s'adapter aux autres parties d'un motif plus grand ? - ---- /task --- - -### Commencer - ---- task --- - -Ouvre le projet [de démarrage Motifs puissants](https://editor.raspberrypi.org/fr-FR/projects/powerful-patterns-starter){:target="_blank"}. Le Code Editor s'ouvrira dans un autre onglet du navigateur. - -Si tu as un compte Raspberry Pi, tu peux cliquer sur le bouton **Enregistrer** pour enregistrer une copie dans tes **Projets**. +Ouvre le [projet de démarrage Motifs puissants](https://editor.raspberrypi.org/fr-FR/projects/powerful-patterns-starter){:target="_blank"}. --- /task --- @@ -52,86 +10,29 @@ Si tu as un compte Raspberry Pi, tu peux cliquer sur le bouton **Enregistrer** p --- task --- -Ajoute du code à `configuration()` pour préparer ton projet. - ---- collapse --- - ---- -title: Définir la taille de l'écran au démarrage de ton programme ---- - -**Choisir :** ajoute une taille adaptée au motif que tu souhaites créer. Tu pourras toujours le modifier ultérieurement au fur et à mesure de l'évolution de ton projet. +Choisis une taille et une couleur d'arrière-plan. --- code --- --- language: python -filename: main.py - setup() line_numbers: true line_number_start: 6 -line_highlights: 7 +line_highlights: 7-8 --- def setup(): - size(400, 400) # Choisis une taille - ---- /code --- - ---- /collapse --- - ---- collapse --- - ---- -title: Définir la couleur d'arrière-plan au démarrage de ton programme ---- - -Pense à l'endroit où tu veux dessiner ton arrière-plan. Tu peux : -+ Ajouter du code à `configuration()` pour que l'arrière-plan soit dessiné une fois lorsque tu exécutes ton projet -+ Ajouter du code à `dessin()` pour que l'arrière-plan soit redessiné à chaque exécution de la fonction `dessin()` - ---- code --- ---- -language: python -filename: main.py - setup() -line_numbers: true -line_number_start: 6 -line_highlights: 8 ---- -def setup(): - size(400, 400) + size(400, 400) # Choisis une taille background(255, 255, 255) # Essaie différents nombres pour changer la couleur --- /code --- ---- /collapse --- - -[[[generic-theory-simple-colours]]] - --- /task --- --- task --- -**Débogage :** il est possible que tu trouves des bogues dans ton projet que tu dois corriger. Voici quelques bogues assez courants. - ---- collapse --- - ---- -title: J'ai modifié ma taille et ma couleur, mais la zone de sortie reste la même ---- - -Après avoir modifié le code, tu devras `exécuter` ton projet pour voir les changements dans la zone de sortie. - ---- /collapse --- - ---- collapse --- - ---- -title: J'ai essayé différents numéros, mais la couleur d'arrière-plan ne change pas ---- +**Test :** exécute ton projet pour voir les modifications. La quantité maximale de rouge, de vert ou de bleu est de `255`. Assure-toi que toutes tes valeurs de couleur `d'arrière-plan` sont comprises entre `0` et `255`. ---- /collapse --- - --- /task --- ---- save --- diff --git a/fr-FR/step_3.md b/fr-FR/step_3.md index f7446f49..c3a80b03 100644 --- a/fr-FR/step_3.md +++ b/fr-FR/step_3.md @@ -1,29 +1,25 @@ -## Construire et tester : motif +## Créer un motif
-Il est maintenant temps de réaliser ton motif, le premier élément de ton modèle. +La plupart des modèles ont un seul dessin (appelé le **motif**) qui se répète pour créer un motif.
![Un exemple de motif utilisant différentes formes pour créer le motif.](images/motif.png){:width="300px"}
-Le processus de création de ton motif reflète ce que font souvent les informaticiens lorsqu'ils créent un programme ou une solution à un problème. Ce processus s'appelle **décomposition** et tu utiliseras la décomposition pour créer ton motif. - -

La décomposition consiste à décomposer quelque chose en parties plus petites et plus faciles à comprendre. Cela signifie que tu peux créer un motif une partie à la fois jusqu'à ce qu'il soit terminé.

- -Regarde le motif que tu souhaite recréer. Comment le décomposer en un seul élément (le motif) qui se répète ? - -Dans cet exemple, un motif de papier peint art déco a été décomposé en une collection de formes de base (cinq cercles superposés) qui constitue le motif : +--- task --- -![Un seul motif à cinq cercles à côté d'une image du motif complet art déco avec de nombreuses copies du motif.](images/motif-pattern.png) +Dessine des formes pour créer ton motif. Utilise les astuces en bas de la page si tu as besoin d’aide. -**Astuce :** n'oublie pas de tester ton projet à chaque fois que tu ajoutes quelque chose. Il est beaucoup plus facile de trouver et de corriger les bogues avant d'apporter d'autres modifications. +--- /task --- --- task --- -Tu as acquis des compétences vraiment utiles. Voici un rappel pour t'aider à réaliser ton motif : +**Test :** exécute ton code pour voir à quoi ressemble ton design. + +--- /task --- ### Formes @@ -33,9 +29,8 @@ Tu as acquis des compétences vraiment utiles. Voici un rappel pour t'aider à r [[[processing-python-triangle]]] -### Couleurs et effets -[[[generic-theory-simple-colours]]] +### Couleurs et effets [[[processing-opacity]]] @@ -55,17 +50,7 @@ Tu as acquis des compétences vraiment utiles. Voici un rappel pour t'aider à r [[[generic-python-for-loop-repeat]]] ---- /task --- - ---- task --- - -**Test :** montre ton projet à quelqu'un d'autre pour avoir son avis. Tu souhaites apporter des modifications à ton motif ? - ---- /task --- - ---- task --- - -**Débogage :** il est possible que tu trouves des bogues dans ton projet que tu dois corriger. Voici quelques bogues assez courants. +### Bogues --- collapse --- --- @@ -77,7 +62,6 @@ Si tu souhaites que les formes soient alignées, examine de plus près tes point --- /collapse --- --- collapse --- - --- title: Je ne vois pas certaines des formes de mon motif --- @@ -89,7 +73,6 @@ L'infographie est composée de calques. Dans ton motif, chaque forme est un calq --- /collapse --- --- collapse --- - --- title: Mes cercles/carrés ne sont pas égaux --- @@ -98,10 +81,5 @@ Les troisième et quatrième nombres dans `ellipse` et `rect` sont la largeur et --- /collapse --- -Tu pourrais trouver un bogue qui n'est pas répertorié ici. Peux-tu trouver comment le corriger ? -Nous aimons avoir des nouvelles de tes bogues et de la façon dont tu les as corrigés. Utilise le bouton de commentaires au bas de cette page si tu as trouvé un bogue différent dans ton projet. - ---- /task --- ---- save --- diff --git a/fr-FR/step_4.md b/fr-FR/step_4.md index a46d940d..fa620d6b 100644 --- a/fr-FR/step_4.md +++ b/fr-FR/step_4.md @@ -1,41 +1,27 @@ -## Développer et tester : motif +## Faire le motif -Il est maintenant temps de créer ton motif complet ! +Maintenant que tu as un **motif**, tu peux le répéter pour créer un motif ![Exemples de projets finis dont le motif est utilisé à plusieurs reprises pour former un motif complet.](images/second.gif) -

L'abstraction est la résolution de problèmes en réduisant les détails inutiles. - -

--- task --- -Regarde ce gâteau malaisien en couches (kek lapis Sarawak). Comment le motif change-t-il pour former le motif général ? +Déplace, redimensionne et répète le motif que tu as créé pour créer un motif qui se répète. Utilise les astuces en bas de la page si tu as besoin d’aide. -![Le motif du projet kek lapis Sarawak à côté du motif complet.](images/kek-motif.png) +--- /task --- -Regarde ce papier peint art déco. Comment le motif change-t-il pour former le motif général ? -![Le motif du projet de papier peint art déco à côté du motif complet.](images/spirals-motif.png) +--- task --- -Pense au modèle que tu crées. Comment ton motif change-t-il pour créer le motif général ? Utilise ces questions pour t'aider à faire abstraction : -- Est-ce que tout ou partie du motif tourne ? -- Dans quel sens tourne-t-il ? Et de combien ? -- Le motif comporte-t-il des calques qui se chevauchent ? -- Combien de fois le motif se répète-t-il ? -- Comment la répétition est-elle organisée (c'est-à-dire combien de lignes/colonnes) ? -- Les couleurs changent-elles ? -- Y a-t-il des détails qui ne sont pas inclus dans le motif (c'est-à-dire le glaçage du gâteau malaisien) ? +**Test :** exécute le code pour voir à quoi ressemble ton modèle. --- /task --- ---- task --- -Maintenant que tu en sais plus sur la façon dont le motif se transforme en motif complet, tu peux le programmer en utilisant tes réponses aux questions ci-dessus. -**Astuce :** tu peux « copier » et « coller » le code de n'importe lequel des exemples de l'introduction dans ton projet. Les développeurs professionnels le font tout le temps ! -Tu as acquis des compétences vraiment utiles. Voici un rappel pour t'aider à réaliser ton motif répété : +### Déplacer, faire une rotation et redimensionner [[[processing-matrix]]] @@ -45,58 +31,44 @@ Tu as acquis des compétences vraiment utiles. Voici un rappel pour t'aider à r [[[python-operators]]] -[[[generic-python-for-loop-repeat]]] - --- collapse --- --- -title: Positions aléatoires +title: Modification de la taille de ton motif --- -Tu peux ajouter `from random import randint` en haut de **main.py**, cela te permet d'utiliser la fonction `randint` pour générer des nombres aléatoires. - -Pour utiliser la fonction `randint`, tu dois l'appeler dans ton code. +Si tu utilises un motif que tu as déjà dessiné, il se peut qu'il ne soit pas de la bonne taille. -Une façon d'utiliser l'aléatoire est de déplacer ton motif à une position aléatoire à chaque fois qu'il est dessiné : +Tu peux utiliser `scale()` avant d'appeler la fonction qui dessine ton motif pour changer sa taille. L'utilisation d'une entrée supérieure à "1" agrandira le motif, l'utilisation d'une entrée inférieure à "1" le rendra plus petit. --- code --- --- language: python filename: main.py - draw() - --- - push_matrix() # Commencer la transformation - translate(randint(0, 400), randint(0, 400)) - dessin_motif() - pop_matrix() # Réinitialiser la transformation + scale(0.5) #Moitié de la taille --- /code --- -Tu peux également utiliser l'aléatoire pour modifier les couleurs de ton motif au fur et à mesure qu'il est redessiné. - ---- code --- ---- -language: python -filename: main.py - draw() - ---- +--- /collapse --- - BLEU = color(randint(0, 50), randint(0, 100), randint(150, 255)) +### Répéter ---- /code --- +[[[generic-python-for-loop-repeat]]] ---- /collapse --- +### Aléatoire --- collapse --- - --- -title: Modification de la taille de ton motif +title: Positions aléatoires --- -Si tu utilises un motif que tu as déjà dessiné, il se peut qu'il ne soit pas de la bonne taille. +Tu peux ajouter `from random import randint` en haut de **main.py**, cela te permet d'utiliser la fonction `randint` pour générer des nombres aléatoires. -Tu peux utiliser `scale()` avant d'appeler la fonction qui dessine ton motif pour changer sa taille. L'utilisation d'une entrée supérieure à "1" agrandira le motif, l'utilisation d'une entrée inférieure à "1" le rendra plus petit. +Pour utiliser la fonction `randint`, tu dois l'appeler dans ton code. + +Une façon d'utiliser l'aléatoire est de déplacer ton motif à une position aléatoire à chaque fois qu'il est dessiné : --- code --- --- @@ -105,41 +77,31 @@ filename: main.py - draw() --- - scale(0.5) # Moitié de la taille + push_matrix() # Commencer la transformation + translate(randint(0, 400), randint(0, 400)) + dessin_motif() + pop_matrix() # Réinitialiser la transformation --- /code --- ---- /collapse --- - ---- /task --- - -Tu peux maintenant animer ton motif pour montrer comment tu l'as créé. Souvent, les motifs ont une signification culturelle puissante dans la manière dont ils sont fabriqués ou dans le processus. - ---- task --- - -[[[processing-matrix]]] - -[[[processing-translation]]] - -[[[processing-rotation]]] - -[[[generic-python-for-loop-repeat]]] - ---- /task --- +Tu peux également utiliser l'aléatoire pour modifier les couleurs de ton motif au fur et à mesure qu'il est redessiné. +--- code --- +--- +language: python +filename: main.py - draw() ---- task --- +--- -**Test :** montre ton projet à quelqu'un d'autre pour avoir son avis. Tu souhaites apporter des modifications à ton motif ? + BLEU = color(randint(0, 50), randint(0, 100), randint(150, 255)) ---- /task --- +--- /code --- ---- task --- +--- /collapse --- -**Débogage :** il est possible que tu trouves des bogues dans ton projet que tu dois corriger. Voici quelques bogues courants. +### Bogues --- collapse --- - --- title: Mon motif ne semble pas tourner --- @@ -159,15 +121,6 @@ As-tu plus d'une chose en rotation ? Tu devras peut-être utiliser `push_matrix --- /collapse --- ---- collapse --- ---- -title: Mon motif ne s'anime pas ---- - -Vérifie que tu as utilisé `frame_count()` correctement dans une boucle. - ---- /collapse --- - --- collapse --- --- title: Mon motif ne ressemble pas à ce que je veux qu'il soit @@ -186,20 +139,3 @@ Vérifie la syntaxe de ton code. Te manque-t-il des parenthèses `(` ou `)` ou u --- /collapse --- ---- collapse --- ---- -title: L'animation est trop rapide/trop lente ---- - -Modifie le nombre après `frame_rate =` dans l'appel à la fonction `run()` à la fin de ton programme pour l'amener à la vitesse que tu souhaites. - ---- /collapse --- - -Tu pourrais trouver un bogue qui n'est pas répertorié ici. Peux-tu trouver un moyen de le corriger ? - -Nous aimons avoir des nouvelles de tes bogues et de la façon dont tu les as corrigés. Utilise le bouton de commentaires au bas de cette page si tu as trouvé un bogue différent dans ton projet. - ---- /task --- - - ---- save --- diff --git a/fr-FR/step_5.md b/fr-FR/step_5.md index 889dec64..8a550d17 100644 --- a/fr-FR/step_5.md +++ b/fr-FR/step_5.md @@ -1,98 +1,39 @@ -## Checklist +## Défi -As-tu respecté la **fiche de projet** ? Réfléchis à ton projet et parcours la liste de contrôle ci-dessous et coche celles qui s'appliquent à ton projet. +--- challenge --- -Est-ce que ton motif puissant : +![Exemples terminés avec des éléments d'entrée et des éléments de visage](images/upgrade.gif) --- task --- -Dessine et positionne des formes géométriques pour créer un motif de base (ou motif) ? ---- /task --- - ---- task --- - -Utilise des boucles pour répéter le motif pour remplir l'écran ? +Utiliser du texte et des emojis pour imprimer `print()` une description de ton modèle --- /task --- --- task --- -Anime la façon dont le motif est créé ? +Ajuster la taille de ton motif en fonction de l'`input()` utilisateur --- /task --- -Ton modèle puissant pourrait également : - --- task --- -Utiliser des couleurs vives ou prononcées +Anime ton motif pour qu'il apparaisse par étapes. --- /task --- ---- task --- -S'inspirer de ta culture ou de la culture populaire +--- no-print --- ---- /task --- +Ce projet utilise du texte et des emojis pour demander à l'utilisateur de choisir une taille, puis utilise sa réponse pour dimensionner toutes les formes : ---- task --- - -Obtenir l'entrée de l'utilisateur pour redimensionner le motif - ---- /task --- - ---- task --- -Ajouter du texte et des emojis pour imprimer des détails sur ton art +[Tartan McEwen](https://editor.raspberrypi.org/fr-FR/projects/mcewen-tartan-example){:target="_blank"} ---- /task --- - ---- task --- - -Translater le motif pour créer des variations - ---- /task --- - - ---- task --- - -Partager ton travail avec d'autres dans une galerie en ligne - ---- /task --- -Réfléchir à la façon dont tu as créé ton modèle puissant t'aidera dans tes projets futurs. + -Réponds aux questions ci-dessous en dessinant, en écrivant, en tapant un document, en parlant à quelqu'un ou de ta propre manière créative qui te convient le mieux. - ---- task --- - -Comment as-tu eu tes idées ? - ---- /task --- - ---- task --- - -Quelle(s) nouvelle(s) chose(s) cool as-tu apprise(s) ? - ---- /task --- - ---- task --- - -Les erreurs et les échecs sont souvent le catalyseur de la découverte et du succès. - -Oprah Winfrey a été licenciée de son premier emploi, mais elle est devenue une productrice et philanthrope célèbre et influente. Elle a dit un jour « transformez vos blessures en sagesse ». - -Quelles erreurs as-tu commises et comment t'ont-elles aidé ? - ---- /task --- - -### Tu es maintenant un artiste numérique et un mathématicien ! - -Prends un moment pour célébrer ce que tu as fait. - ---- task --- - -Comment vas-tu utiliser tes nouveaux pouvoirs ? Que feras-tu ensuite ? - ---- /task --- +--- /no-print --- +--- /challenge --- diff --git a/fr-FR/step_6.md b/fr-FR/step_6.md index 648a04b5..4b86fefe 100644 --- a/fr-FR/step_6.md +++ b/fr-FR/step_6.md @@ -1,25 +1,18 @@ -## Améliorer ton projet -Si tu as le temps, tu peux perfectionner ton projet. Tu pourrais déjà avoir des idées pour en ajouter d'autres ou tu voudras peut-être revenir à la première étape et revoir d'autres projets pour plus d'inspiration. +## Que peux-tu faire maintenant ? -![Exemples finis avec entrée et création d'éléments de visage](images/upgrade.gif) -Tu pourrais : -- Utiliser du texte et des emojis pour imprimer `print()` une description de ton modèle -- Ajuster la taille de ton motif en fonction de l'`input()` utilisateur -- Créer un motif à l'échelle à l'aide de ton projet [Créer un visage](https://projects.raspberrypi.org/fr-FR/projects/make-a-face){:target="_blank"} +Essaie notre parcours [Plus de Python](https://projects.raspberrypi.org/fr-FR/pathways/more-python) où tu iras au-delà des bases introduites dans Introduction à Python. Tu apprendras à utiliser des listes, des dictionnaires et des fichiers pour créer des graphiques, des modèles et des illustrations. -Chaque exemple de projet dans l'introduction te permet d'examiner le code, d'obtenir des idées et de voir comment ils fonctionnent. +[[[python-coolest-projects]]] -Ce projet utilise du texte et des emojis pour demander à l'utilisateur de choisir une taille, puis utilise sa réponse pour dimensionner toutes les formes : +Ou, pourquoi ne pas essayer un autre projet [Python](https://projects.raspberrypi.org/fr-FR/projects?software%5B%5D=python) . -**Tartan McEwen** : - +*** -Tu peux retrouver le projet tartan McEwen [ici](https://editor.raspberrypi.org/fr-FR/projects/mcewen-tartan-example){:target="_blank"} +Ce projet a été traduit par des bénévoles: -Jette un coup d'œil à certains projets de modèles puissants créés par des membres de la communauté dans [Powerful patterns - Community library](https://wke.lt/w/s/yyNPQT){:target="_blank"} de la Raspberry Pi Foundation. - ---- save --- +Michel Arnols +Jonathan Vannieuwkerke +Grâce aux bénévoles, nous pouvons donner aux gens du monde entier la chance d'apprendre dans leur propre langue. Vous pouvez nous aider à atteindre plus de personnes en vous portant volontaire pour la traduction - plus d'informations sur [rpf.io/translate](https://rpf.io/translate). diff --git a/fr-FR/step_8.md b/fr-FR/step_8.md index d160781f..da940f46 100644 --- a/fr-FR/step_8.md +++ b/fr-FR/step_8.md @@ -5,12 +5,3 @@ Tu as atteint la fin du parcours [Introduction à Scratch](https://projects.rasp [[[python-coolest-projects]]] Tu peux explorer nos [autres projets Python](https://projects.raspberrypi.org/fr-FR/projects?software%5B%5D=python) et les essayer. - -*** - -Ce projet a été traduit par des bénévoles: - -Michel Arnols -Jonathan Vannieuwkerke - -Grâce aux bénévoles, nous pouvons donner aux gens du monde entier la chance d'apprendre dans leur propre langue. Vous pouvez nous aider à atteindre plus de personnes en vous portant volontaire pour la traduction - plus d'informations sur [rpf.io/translate](https://rpf.io/translate). diff --git a/it-IT/step_3.md b/it-IT/step_3.md index 02e0308e..c119f6a0 100644 --- a/it-IT/step_3.md +++ b/it-IT/step_3.md @@ -11,11 +11,11 @@ Il processo di creazione del tuo modulo è lo stesso che spesso fanno gli informatici quando creano un programma o cercano la soluzione a un problema. Questo processo è chiamato **scomposizione** e ora lo utilizzerai per creare il tuo modulo. -

La decomposizione consiste nello scomporre qualcosa in parti più piccole e più facili da comprendere. Ciò significa che puoi costruire un motivo un pezzp alla volta, fino al suo completamento.

+

La scomposizione consiste nello scomporre qualcosa in parti più piccole e più facili da comprendere. Ciò significa che puoi costruire un motivo un pezzo alla volta, fino al suo completamento.

Guarda il motivo che vuoi ricreare. Come puoi scomporlo in un unico elemento (il modulo) che si ripeterà? -In questo esempio, un motivo di sfondo Art Dèco è stato scomposto nella gruppo base di forme (cinque cerchi sovrapposti) che costituisce il modulo: +In questo esempio, un motivo di sfondo Art Dèco è stato scomposto nel gruppo base di forme (cinque cerchi sovrapposti) che costituisce il modulo: ![Un singolo motivo a cinque cerchi accanto a un'immagine del modello completo Art Dèco con molte copie del modulo.](images/motif-pattern.png) diff --git a/it-IT/step_6.md b/it-IT/step_6.md index dbc031f5..48fe684f 100644 --- a/it-IT/step_6.md +++ b/it-IT/step_6.md @@ -5,9 +5,9 @@ Se hai tempo puoi migliorare il tuo progetto. Potresti avere già idee da aggiun ![Esempi finiti con input e creazione di faccine](images/upgrade.gif) Potresti: -- Usa testo ed emoji per `print()` una descrizione del tuo motivo -- Regola la dimensione del tuo motivo in base ad un `input()` dell'utente -- Crea un motivo in scala usando il tuo [Disegna una faccia](https://projects.raspberrypi.org/it-IT/projects/make-a-face){:target="_blank"} +- Usare testo ed emoji per `print()` una descrizione del tuo motivo +- Regolare la dimensione del tuo motivo in base ad un `input()` dell'utente +- Creare un motivo in scala usando il tuo [Disegna una faccia](https://projects.raspberrypi.org/it-IT/projects/make-a-face){:target="_blank"} Per ogni progetto di esempio che trovi nell'Introduzione, puoi leggere il codice, ottenere idee e vedere come funziona. diff --git a/it-IT/step_8.md b/it-IT/step_8.md index e56d5357..1c59c6e9 100644 --- a/it-IT/step_8.md +++ b/it-IT/step_8.md @@ -12,5 +12,6 @@ Questo progetto è stato tradotto da volontari: Omar Lazzari Paolo Vassallo +Ivan Baldassin Grazie ai volontari, possiamo offrire alle persone di tutto il mondo la possibilità di imparare nella loro lingua. Puoi aiutarci a raggiungere più persone offrendoti come volontario per la traduzione - puoi trovare maggiori informazioni su [rpf.io/translate](https://rpf.io/translate). diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml index 3a07cd66..fa7ffe12 100644 --- a/nl-NL/meta.yml +++ b/nl-NL/meta.yml @@ -1,9 +1,7 @@ --- title: Krachtige patronen hero_image: images/banner.png -description: - - Maak een stukje inspirerende kunst dat kan worden geschaald met behulp van herhaalde - - patronen +description: Maak een stukje inspirerende kunst dat kan worden geschaald met behulp van herhaalde patronen meta_title: Python-coderingsprojecten voor kinderen en tieners | Krachtige patronen meta_description: Leer Python met de codeerprojecten van de Raspberry Pi Foundation voor kinderen en tieners. Creëer een inspirerend kunstwerk met Python met behulp van herhaalde patronen. version: 4 @@ -12,16 +10,15 @@ copyedit: true last_tested: "2021-10-06" steps: - title: Wat ga je maken - - title: Jouw idee - - title: Bouwen en testen - Patroon + - title: Aan de slag completion: - engaged - - title: Uitbreiden en testen - Patroon + - title: Maak een motief completion: - internal - - title: Checklist + - title: Maak het patroon completion: - external - - title: Verbeter je project - - title: Delen + - title: Uitdaging + challenge: true - title: Wat kun je verder nog doen? diff --git a/nl-NL/python-comments.txt b/nl-NL/python-comments.txt index 3d82a83f..09cd8b91 100644 --- a/nl-NL/python-comments.txt +++ b/nl-NL/python-comments.txt @@ -2,150 +2,8 @@ Kies een afmeting Probeer andere getallen om de kleur te veranderen -Transformatie starten - -Transformatie resetten - Halve grootte -Zet de code om eenmalig uit te voeren hier onder - -Zet hier code om bij elk frame uit te voeren - -Houdt dit om je code uit te voeren - -Kies een aantal prachtige kleuren voor de taartlagen - -Jam plakt de lagen aan elkaar - -Wijzig het getal om de hoeveelheid jam te wijzigen - -Negen lagen cake, de 3 kleuren 3 keer herhalend - -hoogte van 3 blokken cake - -De cake is verpakt in een buitenste laag - -Bedek de cake kwadranten niet! - -maak de taart vierkant - -transparante achtergrond - -5 frames per seconde - -Definieer een kwartslag zodat onze code gemakkelijk te lezen is - -begin vanuit het centrum - -Maak het kwart rechtsonder van de cake en draai dan voor de andere kwarten - -teken 4 kwadranten - -voeg de buitenste laag toe - -terug naar de bovenhoek - -buitenste laag - -Definities voor de p5py-bibliotheek - -Vorm - -Lettertypen - -Tekstbericht - -Kleur - -Afbeeldingen - -Omgeving - -Omzetten - -Toetsenbord - -een korte rij vierkanten - -snelle animatie - -dikke rand - -start vanuit het midden van het scherm - -animeert het patroon - -draait het motief - -beweegt het motief - -Ogen - -Mond - -verschoven met de breedte van het kwart-formaat gezicht - -kwart grootte paden - -Patroonkleuren - -blauw - -goud - -start vanaf de linkerbovenhoek van het scherm - -maakt 16 rijen en stopt dan - -animeert 1 rij tegelijk - -maak een rij met motieven - -ga naar beneden om de volgende rij te beginnen - -Kleuren van de draad - -Vierkanten - -een rij vormen - -instellingen opslaan - -draai de vorm 45 graden - -ga terug naar de opgeslagen instellingen - -horizontaal bewegen - -roze - -om te beginnen met halve motieven - -maximaal aantal rijen - -om het patroon naar de volgende rij te verschuiven - -Gebruik in vorm breedte/lengte om in de loop van de tijd te animeren - -McEwen tartan kleuren - -Kleuren van de basisvierkanten - -Kruisende kleuren - -Kleur van het stiksel en overlappende kleur - -Teken afwisselend alle GROENE en BLAUWE basisvierkanten - -GROEN en BLAUW - -Kruisende lijnen - -Teken de afwisselende GELE en RODE kruisende lijnen - -GEEL en ROOD - -Teken de kruisende lijnen van het stiksel +Transformatie starten -Teken de grijze lijnen waar het materiaal overlapt +Transformatie resetten \ No newline at end of file diff --git a/nl-NL/python-translatable.txt b/nl-NL/python-translatable.txt index d85a4edc..62cbedc1 100644 --- a/nl-NL/python-translatable.txt +++ b/nl-NL/python-translatable.txt @@ -1,71 +1,3 @@ -kwadrant - -turquoise - -goud - -tomaat - -jam - -start_y - -buitenste - -geel groen - -kwart - -motief - teken_motief -oranje - -bruin - -green - -cirkel_grootte - -Deze kunst gebruikt veel cirkels! - -motief_grootte - -ORANJE - -PAARS - -GEEL - -BLAUW - -Dit is Filipijns Yakan weven - -motief_breedte - -Dit is McEwen Tartan - -vierkant_grootte - -Welke maat tartan wil je? 20, 50 of 100 - -lijnen - -GROEN - -BASIS_KLEUREN - -ROOD - -KRUISENDE_KLEUREN - -GRIJS - -y_coördinaat - -vierkanten - -tussenruimte - -kruis +BLAUW \ No newline at end of file diff --git a/nl-NL/solutions/.keep b/nl-NL/solutions/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/nl-NL/solutions/Art deco wallpaper.zip b/nl-NL/solutions/Art deco wallpaper.zip deleted file mode 100644 index 0e3cc9e5..00000000 Binary files a/nl-NL/solutions/Art deco wallpaper.zip and /dev/null differ diff --git a/nl-NL/solutions/Art deco wallpaper/main.py b/nl-NL/solutions/Art deco wallpaper/main.py new file mode 100644 index 00000000..fae30468 --- /dev/null +++ b/nl-NL/solutions/Art deco wallpaper/main.py @@ -0,0 +1,37 @@ +#!/bin/python3 + +from p5 import * +from math import random +from random import randint + +def motief(): + global cirkel_grootte + for i in range(5): + ellipse(0, 0, cirkel_grootte / 5 * (5 - i), cirkel_grootte / 5 * (5 - i)) + +def setup(): + size(400, 400) + frame_rate(3) + print('🖌 Deze kunst gebruikt veel cirkels!') + + global cirkel_grootte + + cirkel_grootte = 50 + +def draw(): + + # Patroonkleuren + stroke(40, 35, 100) # blauw + stroke_weight(2) # dikke rand + fill(200, 180, 128) # goud + + translate(0,0) # start vanaf de linkerbovenhoek van het scherm + + if frame_count <= 16: # maakt 16 rijen aan en stopt dan + for row in range (frame_count): # animeert 1 rij tegelijk + for shape in range(16): # maak een rij motieven aan + motief() + translate(cirkel_grootte / 2, 0) + translate(-width, cirkel_grootte / 2) # ga naar beneden om de volgende rij te beginnen + +run() \ No newline at end of file diff --git a/nl-NL/solutions/Art deco wallpaper/p5.py b/nl-NL/solutions/Art deco wallpaper/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/Art deco wallpaper/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/solutions/Face mask pattern.zip b/nl-NL/solutions/Face mask pattern.zip deleted file mode 100644 index bd9fbc8b..00000000 Binary files a/nl-NL/solutions/Face mask pattern.zip and /dev/null differ diff --git a/nl-NL/solutions/Face mask pattern/main.py b/nl-NL/solutions/Face mask pattern/main.py new file mode 100644 index 00000000..b424db33 --- /dev/null +++ b/nl-NL/solutions/Face mask pattern/main.py @@ -0,0 +1,46 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def teken_motief(): + oranje = color(191, 64, 191) + bruin = color(200,120,0) + groen = color(100,155,0) + fill(oranje) + ellipse(200, 200, 200, 190) + fill(0) + # Ogen + ellipse(160, 190, 30, 30) + ellipse(240, 190, 30, 30) + fill(255) + ellipse(165, 200, 10, 10) + ellipse(245, 200, 10, 10) + # Mond + noFill() + stroke(255, 255, 255) + ellipse(150, 250, 30, 30) + ellipse(250, 250, 30, 30) + fill(255, 255, 255) + noStroke() + rect(150, 230, 100, 40) + fill(108, 200, 206) + rect(152, 235, 96, 30) + + +def setup(): + size(400, 400) + background(255) + no_stroke() + frame_rate(10) + + +def draw(): + push_matrix() + translate(randint(-50, 350), randint(-50, 350)) # offset met de breedte van het kwart-grootte vlak + scale(0.25) # kwart grootte paden + teken_motief() + pop_matrix() + + +run() \ No newline at end of file diff --git a/nl-NL/solutions/Face mask pattern/p5.py b/nl-NL/solutions/Face mask pattern/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/Face mask pattern/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/solutions/Fibonacci-sequence.zip b/nl-NL/solutions/Fibonacci-sequence.zip deleted file mode 100644 index 96509ea8..00000000 Binary files a/nl-NL/solutions/Fibonacci-sequence.zip and /dev/null differ diff --git a/nl-NL/solutions/Fibonacci-sequence/main.py b/nl-NL/solutions/Fibonacci-sequence/main.py new file mode 100644 index 00000000..1b7c7a7d --- /dev/null +++ b/nl-NL/solutions/Fibonacci-sequence/main.py @@ -0,0 +1,43 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def setup(): + size(800, 800) + frame_rate(2) + stroke_weight(2) + background(255) + ellipseMode(CORNER) + +def draw(): + + BLAUW = color(0, 0, 255) + ZWART = color(0, 0, 0) + translate(width/2, height/2) + + # Motief + rect(0, 0, 1, 1) + arc(0, 0, 1, 1, radians(90), radians(180)) + translate(1,1) + rotate(radians(270)) + + eerste = 0 + tweede = 1 + volgende = eerste + tweede + + # Patroon + if frame_count < 20: + for i in range (frame_count): + stroke(ZWART) + rect(0, 0, volgende, volgende) + no_fill() + stroke(BLAUW) + arc(0, -volgende, volgende*2, volgende*2, radians(90), radians(180)) + translate(volgende,volgende) + rotate(radians(270)) + eerste = tweede + tweede = volgende + volgende = eerste + tweede + +run() \ No newline at end of file diff --git a/nl-NL/solutions/Fibonacci-sequence/p5.py b/nl-NL/solutions/Fibonacci-sequence/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/Fibonacci-sequence/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/solutions/Kek lapis Sarawak.zip b/nl-NL/solutions/Kek lapis Sarawak.zip deleted file mode 100644 index 951d1aba..00000000 Binary files a/nl-NL/solutions/Kek lapis Sarawak.zip and /dev/null differ diff --git a/nl-NL/solutions/Kek lapis Sarawak/draw.py b/nl-NL/solutions/Kek lapis Sarawak/draw.py new file mode 100644 index 00000000..fa932764 --- /dev/null +++ b/nl-NL/solutions/Kek lapis Sarawak/draw.py @@ -0,0 +1,134 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() diff --git a/nl-NL/solutions/Kek lapis Sarawak/main.py b/nl-NL/solutions/Kek lapis Sarawak/main.py new file mode 100644 index 00000000..21a2dfff --- /dev/null +++ b/nl-NL/solutions/Kek lapis Sarawak/main.py @@ -0,0 +1,67 @@ +#!/bin/python3 + +from draw import * +from time import * + +# Gebaseerd op de prachtige Maleisische geometrische taartkunst: Kek lapis Sarawak + +def kwadrant(): + + # Kies een aantal prachtige kleuren voor de taartlagen + turkoois = color(64, 224, 208) + goud = color(255, 215, 0) + tomaat = color(255, 99, 71) + + # Jam plakt de lagen aan elkaar + jam = jolor(255, 165, 0) + stroke(jam) + stroke_weight(2) # Wijzig het getal om de hoeveelheid jam te wijzigen + + # Negen lagen cake, waarbij de 3 kleuren 3 keer worden herhaald + for i in range(3): + start_y = i * 60 # hoogte van 3 blokken cake + fill(turkoois) + rect(0, start_y, 180, 20) + fill(goud) + rect(0, start_y + 20, 180, 20) + fill (tomaat) + rect(0, start_y + 40, 180, 20) + + +def buitenste(): + + # De cake is verpakt in een buitenste laag + geelgroen = color(154, 205, 50) + + no_fill() # Bedek de taartkwadranten niet! + stroke(geelgroen) + stroke_weight(20) + rect(10, 10, 380, 380, 20) + + +def setup(): + size(400, 400) # maak de taart vierkant + background(255, 255, 255, 0) # transparante achtergrond + frame_rate(5) # 5 frames per seconde + + +def draw(): + + # Definieer een kwartslag zodat onze code gemakkelijk te lezen is + kwart = radians(90) + + translate(200, 200) # start vanuit het midden + + # Maak het kwart rechtsonder van de cake en draai dan voor de andere kwarten + + if frame_count <= 4: # teken maximaal 4 kwadranten + for i in range(frame_count): + kwadrant() + rotate(kwart) + + if frame_count == 5: # voeg de buitenste laag toe + translate(-200, -200) # terug naar de bovenhoek + buitenste() # buitenste laag + + +run() diff --git a/nl-NL/solutions/McEwen tartan.zip b/nl-NL/solutions/McEwen tartan.zip deleted file mode 100644 index 3e88394e..00000000 Binary files a/nl-NL/solutions/McEwen tartan.zip and /dev/null differ diff --git a/nl-NL/solutions/McEwen tartan/main.py b/nl-NL/solutions/McEwen tartan/main.py new file mode 100644 index 00000000..b8110f7d --- /dev/null +++ b/nl-NL/solutions/McEwen tartan/main.py @@ -0,0 +1,79 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + frame_rate(10) + print('🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁢󠁳󠁣󠁴󠁿 Dit is McEwen Tartan 🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁧󠁢󠁳󠁣󠁴󠁿') + + global vierkant_grootte + vierkant_grootte = int(input('Welke maat 🏴󠁧󠁢󠁳󠁣󠁴󠁿tartan wil je? 20, 50 of 100')) + +def draw(): + + lijnen = 10 * frame_count # Gebruik de breedte/lengte van de vorm om in de loop van de tijd te animeren + + # McEwen tartankleuren + # Kleuren van de basisvierkanten + BLAUW = color(83, 143, 200) + GROEN = color(78, 163, 162) + BASIS_KLEUREN = [GROEN, BLAUW] + + # Kruiskleuren + GEEL = color(155, 176, 135) + ROOD = color(155, 129, 113) + KRUIS_KLEUREN = [GEEL, ROOD] + + # Kleur van het stiksel en overlappende kleur + GRIJS = color(78, 99, 86) + + # Teken afwisselend alle GROENE en BLAUWE basisvierkanten + no_stroke() + y_coordinaat = 0 + vierkanten = width/vierkant_grootte + + for i in range (int(vierkanten)): + gat = 0 + for j in range (int(vierkanten)): + fill(BASIS_KLEUREN[j % 2]) # GROEN en BLAUW + rect(gat, y_coordinaat, vierkant_grootte, vierkant_grootte) + gat = gat + vierkant_grootte + y_coordinaat = y_coordinaat + vierkant_grootte + + # Kruizen + stroke(GRIJS) + + # TEKEN afwisselend DE GELE en RODE kruizen + for i in range (4): + fill(GEEL) + kruis = vierkant_grootte / 2 - 2 + for i in range (int(vierkanten/2)): + fill(KRUIS_KLEUREN[i% 2]) #GEEL en ROOD + rect(kruis, 0, 4, lijnen) + rect(0, kruis, lijnen, 4) + kruis = kruis + 2 * vierkant_grootte + # Teken de stikkruisen + no_fill() + kruis = vierkant_grootte + vierkant_grootte / 2 - 2 + for i in range (int(vierkanten)): + rect(kruis, 0, 4, lijnen) + rect(0, kruis, lijnen, 4) + kruis = kruis + vierkant_grootte + + # Teken de grijze lijnen waar het materiaal overlapt + no_stroke() + fill(GRIJS, 100) + gap = vierkant_grootte - 4 + for i in range (int(vierkanten)): + rect(gap, 0, 8, lijnen) + gap = gap + vierkant_grootte + gap = vierkant_grootte - 4 + for i in range (int(vierkanten)): + rect(0, gap, lijnen, 8) + gap = gap + vierkant_grootte + +run() + + + diff --git a/nl-NL/solutions/McEwen tartan/p5.py b/nl-NL/solutions/McEwen tartan/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/McEwen tartan/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/solutions/Spirals/main.py b/nl-NL/solutions/Spirals/main.py new file mode 100644 index 00000000..5be78308 --- /dev/null +++ b/nl-NL/solutions/Spirals/main.py @@ -0,0 +1,30 @@ +#!/bin/python3 + +from p5 import * +from math import random +from random import randint + +def motief(): + 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): # een korte rij vierkanten + rect(i * 5, 0, 5, 5) + +def setup(): + size(400, 400) + frame_rate(10) # snelle animatie + stroke_weight(2) # dikke rand + background(255) + +def draw(): + translate(200, 200) # start vanuit het midden van het scherm + if frame_count < 150: + for i in range(frame_count): # animeert het patroon + motief() + rotate(5) # draait het motief + translate(i,i) # verplaatst het motief + +run() \ No newline at end of file diff --git a/nl-NL/solutions/Spirals/p5.py b/nl-NL/solutions/Spirals/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/Spirals/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/solutions/Yakan Weaving.zip b/nl-NL/solutions/Yakan Weaving.zip deleted file mode 100644 index ab823312..00000000 Binary files a/nl-NL/solutions/Yakan Weaving.zip and /dev/null differ diff --git a/nl-NL/solutions/Yakan Weaving/main.py b/nl-NL/solutions/Yakan Weaving/main.py new file mode 100644 index 00000000..db22104d --- /dev/null +++ b/nl-NL/solutions/Yakan Weaving/main.py @@ -0,0 +1,64 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def motief(): + motief_grootte = 100 + + #Kleuren van de draad + ORANJE = color(254, 96, 1) + PAARS = color(135, 18, 192) + GEEL = color(243, 200, 19) + BLAUW = color(83, 171, 176) + + # Vierkanten + fill(ORANJE) + rect(0, 0, motief_grootte/2, motief_grootte/2) + fill(PAARS) + rect(50, 0, motief_grootte/2, motief_grootte/2) + fill(GEEL) + rect(0, 50, motief_grootte/2, motief_grootte/2) + fill(BLAUW) + rect(50, 50, motief_grootte/2, motief_grootte/2) + fill(PAARS) + rect(0, 0, motief_grootte/4, motief_grootte/4) + fill(ORANJE) + rect(50, 0, motief_grootte/4, motief_grootte/4) + fill(BLAUW) + rect(0, 50, motief_grootte/4, motief_grootte/4) + fill(GEEL) + rect(50, 50, motief_grootte/4, motief_grootte/4) + +def draai_motief(): + + for shape in range(5): # rij vormen + pushMatrix() # instellingen opslaan + rotate(radians(45)) # vorm 45 graden draaien + motief() + popMatrix() # ga terug naar opgeslagen instellingen + translate(motief_breedte, 0) # horizontaal bewegen + +def setup(): + size(400, 400) + frame_rate(3) + background(250, 5, 94) # roze + no_stroke() + print('Dit is 🇵🇭 Yakan-weven ') + +def draw(): + + global motief_breedte + motief_breedte = 150 + + translate(-motief_breedte/2, -motief_breedte/2) # om te beginnen met halve motieven + + if frame_count < 20: # maximum rijen + for row in range(frame_count): + draai_motief() + if row % 2 == 0: # om het patroon op de volgende rij te verschuiven + translate(-motief_breedte * 5 + 75, 80) + else: + translate(-motief_breedte * 5 - 75, 80) + +run() diff --git a/nl-NL/solutions/Yakan Weaving/p5.py b/nl-NL/solutions/Yakan Weaving/p5.py new file mode 100644 index 00000000..d265ad1d --- /dev/null +++ b/nl-NL/solutions/Yakan Weaving/p5.py @@ -0,0 +1,135 @@ +# Definities voor compatibilteit met de p5py-bibliotheek +from processing import * +import __main__ + +# Vorm +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Lettertypen +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Tekst +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Kleur +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Afbeeldingen +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Omgeving +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Omzetten +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Toetsenbord + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md index 9a155934..c98d9540 100644 --- a/nl-NL/step_1.md +++ b/nl-NL/step_1.md @@ -1,104 +1,26 @@ -## Wat ga je maken -Maak een stukje inspirerende kunst die kan worden geschaald met behulp van herhaalde patronen. - -Je krachtige patroon moet voldoen aan de **projectbeschrijving**. - -

-Een projectbeschrijving beschrijft wat een project moet doen. Het is een beetje alsof je een missie krijgt om te voltooien. -

- -Je gaat: -+ Geometrische vormen tekenen en positioneren om een basispatroon (of 'motief') te creëren -+ `for` loops gebruiken om het patroon te `verplaatsen` om het scherm te vullen -+ `frame_rate` en `frame_count` gebruiken om het maken van het patroon te animeren - -

Patronen zijn overal om ons heen, in textiel, natuur, kunst, tradities en design. Het startpunt van een patroon wordt een motief genoemd, een element dat kan worden herhaald en gerangschikt om veel verschillende patronen te creëren. -

+Maak een stukje inspirerende kunst dat kan worden geschaald met behulp van herhaalde patronen. --- no-print --- -### Afspelen ▶️ - ---- task --- - -
-
- -Klik hieronder op de knop **Run** om dit voorbeeld te bekijken en na te denken over het herhaalde motief. Hoe zou je beschrijven wat er in de animatie gebeurt? -**Kek lapis Sarawak**: -
-
- -Je kunt het Kek lapis Sarawak-project [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/repeated-patterns-example){:target="_blank"} ---- /task --- - -
- -### PROJECT BESCHRIJVING: Creëer een **krachtig patroon** -
- -Je krachtige patroon moet: -+ Geometrische vormen tekenen en positioneren om een basispatroon te creëren -+ Loops gebruiken om het patroon te herhalen om het scherm te vullen -+ Animeren hoe het patroon is gemaakt - -Je krachtige patroon kan: -+ Gedurfde of opvallende kleuren gebruiken -+ Geïnspireerd zijn op je eigen cultuur of populaire cultuur -+ Input van de gebruikers vragen om het formaat van het patroon te wijzigen -+ Tekst en emoji toevoegen om details over je kunstwerk af te drukken -+ Het patroon verplaatsen om variaties te creëren -
- -### Ideeën opdoen 💭 - ---- task --- - -Voer deze voorbeeldprojecten uit om ideeën voor je patroon op te doen. - -Hoe zijn de motieven opgebouwd uit cirkels, ellipsen, vierkanten, rechthoeken en driehoeken?: - -**Spiralen**: - -Je kunt het Spiralen-project [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/spirals-pattern-example){:target="_blank"} - -**Willekeurige gezichten**: - -Je kunt het project Willekeurige gezichten [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/random-faces-example){:target="_blank"} - -**Art deco behang**: - -Je kunt het Art Deco-project [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/art-deco-example){:target="_blank"} - -**Yakan weven**: - -Je kunt het Yakan weven project [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/yakan-weaving-example){:target="_blank"} - ---- /task --- --- /no-print --- --- print-only --- -Bekijk deze voorbeelden en denk na over het herhaalde motief. Hoe zijn de patronen opgebouwd uit cirkels, ellipsen, vierkanten, rechthoeken en driehoeken? +[Spiralen](https://editor.raspberrypi.org/nl-NL/projects/spirals-pattern-example) +![Voltooid Spiralen-project.](images/spirals.png) + +[Willekeurige gezichten](https://editor.raspberrypi.org/nl-NL/projects/random-faces-example) +![Voltooid Willekeurige gezichten project.](images/random_faces.png) + +[Art deco](https://editor.raspberrypi.org/nl-NL/projects/art-deco-example) +![Voltooid Art deco project.](images/art_deco.png) -![Voltooi het Kek lapis Sarawak-project.](images/kek.png) -Je kunt het Kek lapis Sarawak-project hier vinden https://editor.raspberrypi.org/nl-NL/projects/repeated-patterns-example -![Voltooi het Spiralen project.](images/spirals.png) -Je kunt het Spiralen project hier vinden https://editor.raspberrypi.org/nl-NL/projects/spirals-pattern-example -![Voltooi het Willekeurige gezichten project.](images/random_faces.png) -Je kunt het Willekeurige gezichten project hier vinden https://editor.raspberrypi.org/nl-NL/projects/random-faces-example -![Voltooi het Art deco-project.](images/art_deco.png) -Je vindt het Art deco-project hier https://editor.raspberrypi.org/nl-NL/projects/art-deco-example -![Voltooi het Yakan-weefproject.](images/yakan.png) -Je vindt het Yakan-weefproject hier https://editor.raspberrypi.org/nl-NL/projects/yakan-weaving-example +[Yakan weven](https://editor.raspberrypi.org/nl-NL/projects/yakan-weaving-example) +![Voltooid Yakan weven project.](images/yakan.png) --- /print-only --- diff --git a/nl-NL/step_2.md b/nl-NL/step_2.md index 0bc754da..657acfd1 100644 --- a/nl-NL/step_2.md +++ b/nl-NL/step_2.md @@ -1,137 +1,38 @@ -## Jouw idee - -Gebruik deze stap om je krachtige patroon te plannen. Je kunt het plannen door erover na te denken, te knutselen, te tekenen of te schrijven, of hoe je maar wilt! - -![Een geanimeerde gif van drie verschillende voorbeelden die verschillende vormen gebruiken om de motieven en animaties te creëren om het patroon te doen groeien.](images/ideas-1.gif) - -

Patronen hebben vaak een culturele of religieuze betekenis. Bepaalde geometrische vormen en posities kunnen symbolische of heilige betekenissen hebben. Of het patroon zich nu in architectuur, stof, kunst, koken of iets anders bevindt, het proces van het maken van het patroon kan ook belangrijk zijn.

- -### Waarom maak je jouw krachtige patroon? +## Aan de slag --- task --- -Denk na over het doel van het patroon dat je gaat maken. - -Dat kan zijn: -- Om iets belangrijks uit jouw cultuur of die van je familie uit te drukken -- Een geometrisch patroon na te maken dat iets voor je betekent -- Iets wat je met een groep mensen maakt om een bepaald boodschap te sturen (bijvoorbeeld een quilt) -- Iets boeiends over een hobby laten zien (bijvoorbeeld kunst, wetenschap, natuur, muziek) - -**Tip:** Patronen zijn overal! Je kunt ervoor kiezen om inspiratie op te doen door op patronenjacht te gaan in je omgeving of online. +Open het [Krachtige patronen startproject](https://editor.raspberrypi.org/nl-NL/projects/powerful-patterns-starter){:target="_blank"} project. --- /task --- -

Naast een symbolische betekenis, laten patronen de wiskunde zien die overal om ons heen is. Wiskunde helpt ons de wereld om ons heen te begrijpen en we kunnen wiskundige patronen vinden in kunst, literatuur en de natuur.

- -### Voor wie is het? +### Stel je project in --- task --- -Bedenk voor wie je je patroon gaat maken (je **doelgroep**). - -Wat is de betekenis van je patroon? Zullen de kleuren, vormen of manier waarop het patroon wordt herhaald iets speciaals voor jou of je publiek betekenen? - -Het delen van je patroon is een geweldige manier om iets over jezelf of je cultuur uit te drukken. - -Als je als groep een patroon maakt, moet je motief dan een bepaalde afmeting of vorm hebben om bij andere delen van een groter patroon te passen? - ---- /task --- - -### Aan de slag - ---- task --- - -Open het [Krachtige patronen startersproject](https://editor.raspberrypi.org/nl-NL/projects/powerful-patterns-starter){:target="_blank"} project. De code-editor wordt geopend in een ander browsertabblad. - -Als je een Raspberry Pi-account hebt, kun je op de **Save** knop klikken om een kopie op te slaan in je **Projects**. - ---- /task --- - -### Je project opzetten - ---- task --- - -Voeg code toe aan `setup()` om je project klaar te maken. - ---- collapse --- - ---- -title: De schermgrootte instellen wanneer het programma wordt gestart ---- - -**Kies:** Voeg een afmeting toe die past bij het patroon dat je wilt maken. Je kunt dit later altijd wijzigen naarmate je project evolueert. +Kies een formaat en een achtergrondkleur. --- code --- --- language: python -filename: main.py - setup() line_numbers: true line_number_start: 6 -line_highlights: 7 +line_highlights: 7-8 --- def setup(): - size(400, 400) #Kies een afmeting - ---- /code --- - ---- /collapse --- - ---- collapse --- - ---- -title: De achtergrondkleur instellen wanneer het programma wordt gestart ---- - -Bedenk waar je je achtergrond wilt tekenen. Jij kunt: -+ Voeg code toe aan `setup()` zodat de achtergrond één keer wordt getekend wanneer je het project uitvoert -+ Voeg code toe aan `draw()` zodat de achtergrond telkens opnieuw wordt getekend als de functie `draw()` wordt uitgevoerd - ---- code --- ---- -language: python -filename: main.py - setup() -line_numbers: true -line_number_start: 6 -line_highlights: 8 ---- -def setup(): - size(400, 400) + size(400, 400) # Kies een afmeting background(255, 255, 255) # Probeer andere getallen om de kleur te veranderen --- /code --- ---- /collapse --- - -[[[generic-theory-simple-colours]]] - --- /task --- --- task --- -**Debug:** Mogelijk vindt je enkele fouten in jouw project die je moet oplossen. Hier zijn enkele veelvoorkomende fouten. - ---- collapse --- - ---- -title: Ik heb mijn grootte en kleur bijgewerkt, maar het uitvoergebied blijft hetzelfde ---- - -Nadat je de code hebt gewijzigd, moet je je project `uitvoeren` om de wijzigingen in het uitvoergebied te zien. - ---- /collapse --- - ---- collapse --- - ---- -title: Ik heb verschillende getallen geprobeerd, maar de achtergrondkleur verandert niet ---- +**Test:** Voer jouw project uit om de wijzigingen te zien. De maximale hoeveelheid rood, groen of blauw is `255`. Zorg ervoor dat alle `achtergrond` kleurwaarden tussen `0` en `255` liggen. ---- /collapse --- - --- /task --- ---- save --- diff --git a/nl-NL/step_3.md b/nl-NL/step_3.md index abfbeba1..c628a25e 100644 --- a/nl-NL/step_3.md +++ b/nl-NL/step_3.md @@ -1,29 +1,25 @@ -## Bouwen en testen - Patroon +## Maak een motief
-Nu is het tijd om je motief te maken, het eerste element van je patroon. +De meeste patronen hebben één ontwerp (het **motief**) dat zich herhaalt om een patroon te creëren.
![Een voorbeeld van een motief waarbij verschillende vormen worden gebruikt om het motief te maken.](images/motif.png){:width="300px"}
-Het proces van het maken van je motief weerspiegelt wat computerwetenschappers vaak doen als ze een programma of oplossing voor een probleem maken. Dit proces wordt **decompositie** genoemd en je zult decompositie gebruiken om je motief te maken. - -

Decompositie is iets opsplitsen in kleinere en gemakkelijker te begrijpen delen. Dit betekent dat je een patroon deel per deel kunt bouwen totdat het compleet is.

- -Kijk naar het patroon dat je wilt namaken. Hoe kun je het opsplitsen in één enkel element (het motief) dat zich herhaalt? - -In dit voorbeeld werd een art deco-behangpapier patroon ontleed tot de basis verzameling van vormen (vijf cirkels over elkaar gelegd) die het motief vormen: +--- task --- -![Een enkel motief van vijf cirkels naast een afbeelding van het volledige art deco patroon met veel kopieën van het motief.](images/motif-pattern.png) +Teken vormen om je eigen motief te maken. Als je hulp nodig hebt, kun je de tips onderaan de pagina gebruiken. -**Tip:** Denk eraan om je project elke keer dat je iets toevoegt, te testen. Het is veel gemakkelijker om fouten te vinden en op te lossen voordat je meer wijzigingen aanbrengt. +--- /task --- --- task --- -Je hebt een aantal echt nuttige vaardigheden opgebouwd. Hier is een geheugensteuntje om je te helpen bij het maken van jouw motief: +**Test:** Voer je code uit om te zien hoe je ontwerp eruitziet. + +--- /task --- ### Vormen @@ -33,9 +29,8 @@ Je hebt een aantal echt nuttige vaardigheden opgebouwd. Hier is een geheugensteu [[[processing-python-triangle]]] -### Kleuren en effecten -[[[generic-theory-simple-colours]]] +### Kleuren en effecten [[[processing-opacity]]] @@ -55,17 +50,7 @@ Je hebt een aantal echt nuttige vaardigheden opgebouwd. Hier is een geheugensteu [[[generic-python-for-loop-repeat]]] ---- /task --- - ---- task --- - -**Test:** Laat iemand anders jouw project zien en vraag feedback. Wil je iets aan je motief veranderen? - ---- /task --- - ---- task --- - -**Debug:** Mogelijk vindt je enkele fouten in jouw project die je moet oplossen. Hier zijn enkele veelvoorkomende fouten. +### Fouten --- collapse --- --- @@ -77,7 +62,6 @@ Als je wilt dat de vormen worden uitgelijnd, kijk dan eens goed naar je coördin --- /collapse --- --- collapse --- - --- title: Ik kan sommige vormen in mijn motief niet zien --- @@ -89,19 +73,13 @@ Computerafbeeldingen bestaan uit lagen. In je motief is elke vorm een laag. Obje --- /collapse --- --- collapse --- - --- -title: Mijn cirkels/vierkanten zijn niet gelijk +titel: Mijn cirkels/vierkanten zijn niet gelijk --- -Het derde en vierde cijfer in `ellips` en `rect` zijn de breedte en hoogte. Als je ze hetzelfde maakt, krijg je een cirkel of vierkant. +Het derde en vierde cijfer in `ellipse` en `rect` zijn de breedte en de hoogte. Als je ze hetzelfde maakt, krijg je een cirkel of vierkant. --- /collapse --- -Mogelijk vind je een bug die hier niet wordt vermeld. Kun je erachter komen hoe je het kunt oplossen? -We horen graag over je fouten en hoe je ze hebt opgelost. Gebruik de feedback knop onderaan deze pagina als je een andere bug in je project hebt gevonden. - ---- /task --- ---- save --- diff --git a/nl-NL/step_4.md b/nl-NL/step_4.md index 9e1b1e51..fa1aa57b 100644 --- a/nl-NL/step_4.md +++ b/nl-NL/step_4.md @@ -1,41 +1,27 @@ -## Uitbreiden en testen: Patroon +## Maak het patroon -Nu is het tijd om je volledige patroon te maken! +Nou dat je een **motief** hebt gemaakt, kun je het herhalen om een patroon te creëren ![Voorbeelden van voltooide projecten waarbij het motief herhaaldelijk is gebruikt om een volledig patroon te vormen.](images/second.gif) -

Abstractie is het oplossen van problemen door geen rekening te houden met onnodige details. - -

--- task --- -Kijk naar deze Maleisische laagjescake (kek lapis Sarawak). Hoe verandert het motief om het gehele patroon te maken? +Verplaats, vergroot of verklein het motief dat je hebt gemaakt en herhaal het om een herhalend patroon te maken. Als je hulp nodig hebt, kun je de tips onderaan de pagina gebruiken. -![Het motief uit het kek lapis Sarawak project naast het volledige patroon.](images/kek-motif.png) +--- /task --- -Kijk eens naar dit art deco behang. Hoe verandert het motief om het gehele patroon te maken? -![Het motief uit het art deco behangpapier project naast het volledige patroon.](images/spirals-motif.png) +--- task --- -Denk na over het patroon dat je aan het maken bent. Hoe verandert het motief om het algemene patroon te maken? Gebruik deze vragen om je te helpen bij de abstractie: -- Roteert het gehele of een deel van het motief? -- In welke richting draait het? En met hoeveel? -- Zijn er lagen in het patroon die elkaar overlappen? -- Hoe vaak herhaalt het motief zich? -- Hoe is de herhaling georganiseerd (dwz hoeveel rijen/kolommen)? -- Veranderen de kleuren? -- Zijn er details die niet in het motief zijn verwerkt (bijv. de kers op de Maleisische laagcake)? +**Test:** Voer de code uit om te zien hoe je patroon eruitziet. --- /task --- ---- task --- -Nu je meer weet over hoe het motief het hele patroon gaat vormen, kun je het programmeren met je antwoorden op de bovenstaande vragen. -**Tip:** U kunt code uit elk van de voorbeelden in de inleiding in uw project 'kopiëren' en 'plakken'. Professionele ontwikkelaars doen dit altijd zo! -Je hebt een aantal echt nuttige vaardigheden opgebouwd. Hier is een geheugensteuntje om je te helpen bij het maken van je herhaalde patroon: +### Verplaatsen, roteren en grootte wijzigen [[[processing-matrix]]] @@ -45,58 +31,44 @@ Je hebt een aantal echt nuttige vaardigheden opgebouwd. Hier is een geheugensteu [[[python-operators]]] -[[[generic-python-for-loop-repeat]]] - --- collapse --- --- -title: Willekeurige posities +title: De grootte van je motief wijzigen --- -Je kan `from random import randint` toevoegen bovenaan **main.py**, dit laat je te om de `randint` functie te gebruiken om willekeurige getallen te genereren. - -Om de `randint` functie te gebruiken, moet je deze in je code aanroepen. +Als je een motief gebruikt dat je al hebt getekend, heeft het misschien niet de juiste grootte. -Een manier om random te gebruiken is door je motief naar een willekeurige positie te verplaatsen iedere keer dat het getekend wordt: +Je kunt `scale()` gebruiken voordat je de functie aanroept die je motief tekent om de grootte te wijzigen. Als je invoer groter is dan '1', wordt het motief groter, als je invoer kleiner is dan '1', wordt het kleiner. --- code --- --- language: python filename: main.py - draw() - --- - push_matrix() #Transformatie starten - translate(randint(0, 400), randint(0, 400)) - teken_motief() - pop_matrix() #Transformatie resetten + scale(0.5) # Halve grootte --- /code --- -Je kan random ook gebruiken om de kleuren in je motief te veranderen wanneer het opnieuw getekend wordt. - ---- code --- ---- -language: python -filename: main.py - draw() +--- /collapse --- ---- +### Herhalen - BLAUW = color(randint(0, 50), randint(0, 100), randint(150, 255)) +[[[generic-python-for-loop-repeat]]] ---- /code --- - ---- /collapse --- +### Willekeurigheid --- collapse --- - --- -title: De grootte van je motief wijzigen +title: Willekeurige posities --- -Als je een motief gebruikt dat je al hebt getekend, is het misschien niet de juiste grootte. +Je kunt `from random import randint` toevoegen bovenaan **main.py**, dit staat je toe om de `randint` functie te gebruiken om willekeurige getallen te genereren. -Je kunt `scale()` gebruiken voordat je de functie oproept die je motief tekent om de grootte te wijzigen. Als je invoer groter is dan '1', wordt het motief groter, als je invoer kleiner is dan '1', wordt het kleiner. +Om de `randint` functie te gebruiken, moet je deze in je code aanroepen. + +Een manier om random te gebruiken is door je motief naar een willekeurige positie te verplaatsen iedere keer dat het getekend wordt: --- code --- --- @@ -105,41 +77,31 @@ filename: main.py - draw() --- - scale(0.5) #Halve grootte + push_matrix() # Transformatie starten + translate(randint(0, 400), randint(0, 400)) + teken_motief() + pop_matrix() # Transformatie resetten --- /code --- ---- /collapse --- - ---- /task --- - -Nu kan je jouw patroon animeren om te laten zien hoe je het hebt gemaakt. Vaak hebben patronen een krachtige culturele betekenis in de manier waarop ze worden gemaakt of in het proces. - ---- task --- - -[[[processing-matrix]]] - -[[[processing-translation]]] - -[[[processing-rotation]]] - -[[[generic-python-for-loop-repeat]]] - ---- /task --- +Je kunt random ook gebruiken om de kleuren in je motief te veranderen wanneer het opnieuw getekend wordt. +--- code --- +--- +language: python +filename: main.py - draw() ---- task --- +--- -**Test:** Laat iemand anders je project zien en vraag feedback. Wil je iets aan je motief veranderen? + BLAUW = color(randint(0, 50), randint(0, 100), randint(150, 255)) ---- /task --- +--- /code --- ---- task --- +--- /collapse --- -**Debug:** Mogelijk vind je enkele fouten in jouw project die je moet oplossen. Hier zijn enkele veelvoorkomende fouten. +### Fouten --- collapse --- - --- title: Mijn motief lijkt niet te roteren --- @@ -159,15 +121,6 @@ Is er meer dan 1 ding dat draait? Mogelijk moet je `push_matrix()` en `pop_matri --- /collapse --- ---- collapse --- ---- -title: Mijn patroon animeert niet ---- - -Controleer of je `frame_count()` correct in een lus hebt gebruikt. - ---- /collapse --- - --- collapse --- --- title: Mijn patroon ziet er niet uit zoals ik het wil @@ -186,20 +139,3 @@ Controleer de syntax van je code. Missen er haakjes `(` of `)` of een dubbele pu --- /collapse --- ---- collapse --- ---- -title: De animatie is te snel/te langzaam ---- - -Verander het getal na `frame_rate =` in de aanroep van de `run()` functie aan het einde van je programma om het op de gewenste snelheid te krijgen. - ---- /collapse --- - -Mogelijk vind je een bug die hier niet wordt vermeld. Kun je erachter komen hoe je het kunt oplossen? - -We horen graag over je fouten en hoe je ze hebt opgelost. Gebruik de feedback knop onderaan deze pagina als je een andere bug in je project hebt gevonden. - ---- /task --- - - ---- save --- diff --git a/nl-NL/step_5.md b/nl-NL/step_5.md index 5d96192e..accd41fd 100644 --- a/nl-NL/step_5.md +++ b/nl-NL/step_5.md @@ -1,98 +1,39 @@ -## Checklist +## Uitdaging -Voldoet je project aan de **projectbeschrijving**? Denk na over je project en doorloop de onderstaande checklist en vink af wat van toepassing is op je project. +--- challenge --- -Gaat jouw krachtige patroon: +![Voltooide voorbeelden met invoer en maak een gezicht elementen](images/upgrade.gif) --- task --- -Geometrische vormen tekenen en positioneren om een basispatroon (of 'motief') te creëren? ---- /task --- - ---- task --- - -Lussen gebruiken om het patroon te herhalen om het scherm te vullen? +Gebruik tekst en emoji om een beschrijving van je patroon te printen met `print()` --- /task --- --- task --- -Animeren hoe het patroon wordt gemaakt? +Pas de grootte van je patroon aan op basis van de `input()` van de gebruiker --- /task --- -Je krachtige patroon kan ook: - --- task --- -Opvallende of betekenisvolle kleuren gebruiken +Animeer je patroon zodat het in fasen verschijnt. --- /task --- ---- task --- -Inspiratie gebruiken uit jouw cultuur of populaire cultuur +--- no-print --- ---- /task --- +Dit project gebruikt tekst en emoji om de gebruiker te vragen een grootte te kiezen en gebruikt vervolgens hun antwoord om alle vormen op maat te maken: ---- task --- - -Input van de gebruiker krijgen om het formaat van het patroon aan te passen - ---- /task --- - ---- task --- -Voeg tekst en emoji toe om details over je kunst af te drukken +[McEwen-ruit](https://editor.raspberrypi.org/nl-NL/projects/mcewen-tartan-example){:target="_blank"} ---- /task --- - ---- task --- - -Translate gebruiken om variaties te maken - ---- /task --- - - ---- task --- - -Deel je werk met anderen in een online galerij - ---- /task --- -Nadenken over hoe je je krachtige patroon hebt gemaakt, zal je helpen bij je toekomstige projecten. + -Beantwoord de onderstaande vragen door te tekenen, te schrijven, in een document te schrijven, met iemand te praten of op je eigen creatieve manier die het beste bij je past. - ---- task --- - -Hoe ben je aan je ideeën gekomen? - ---- /task --- - ---- task --- - -Welke coole nieuwe dingen heb je geleerd? - ---- /task --- - ---- task --- - -Fouten en mislukkingen zijn vaak de katalysator voor ontdekking en succes. - -Oprah Winfrey werd ontslagen bij haar eerste baan, maar ze werd een beroemde en invloedrijke producer en filantroop. Ze zei ooit: "verander je verwondingen in wijsheid". - -Welke fouten heb je gemaakt en hoe hebben ze je geholpen? - ---- /task --- - -### Nu ben je een digitale kunstenaar en wiskundige! - -Neem even de tijd om dit te vieren. - ---- task --- - -Wat ga je met je nieuwe kennis doen? Wat ga je hierna maken? - ---- /task --- +--- /no-print --- +--- /challenge --- diff --git a/nl-NL/step_6.md b/nl-NL/step_6.md index e1a0986d..ce4bfc65 100644 --- a/nl-NL/step_6.md +++ b/nl-NL/step_6.md @@ -1,25 +1,22 @@ -## Verbeter je project -Als je tijd hebt, kun je jouw project verbeteren. Misschien heb je al ideeën om er al meer toe te voegen of wil je misschien teruggaan naar de eerste stap en nog eens naar andere projecten kijken voor meer inspiratie. +## Wat kun je verder nog doen? -![Afgewerkte voorbeelden met invoer en maak een gezicht elementen](images/upgrade.gif) -Je zou: -- Tekst en emoji gebruiken om een beschrijving van je patroon te printen, `print()` -- De grootte van je patroon kunnen aanpassen op basis van de `input()` van de gebruiker -- Een geschaald motief maken gebruik makend van je [Make a face project](https://projects.raspberrypi.org/nl-NL/projects/make-a-face){:target="_blank"} +Probeer ons [Meer Python](https://projects.raspberrypi.org/nl-NL/pathways/more-python) pad, waarin je verder gaat dan de basisbeginselen die in Inleiding tot Python zijn geïntroduceerd. Je gaat leren hoe je lijsten, woordenboeken en bestanden kunt gebruiken om grafieken, modellen en kunstwerken te maken. -Bij elk voorbeeldproject in de Inleiding kun je de code bekijken, ideeën opdoen en zien hoe ze werken. +[[[python-coolest-projects]]] -Dit project gebruikt tekst en emoji om de gebruiker te vragen een afmeting te kiezen en gebruikt vervolgens hun antwoord om alle vormen op maat te maken: +Of probeer een ander [Python](https://projects.raspberrypi.org/nl-NL/projects?software%5B%5D=python) project. -**McEwen tartan**: - +*** -Je kunt het McEwen tartan-project [hier vinden](https://editor.raspberrypi.org/nl-NL/projects/mcewen-tartan-example){:target="_blank"} +Dit project werd vertaald door vrijwilligers: -Bekijk enkele Krachtige Patronen projecten die zijn gemaakt door communityleden in de [Krachtige patronen - Communitybibliotheek](https://wke.lt/w/s/yyNPQT){:target="_blank"} van de Raspberry Pi Foundation. +Christel Haex +Iny van Beuningen +Jeroen Wernsen +Robert-Jan Kempenaar + +Dankzij vrijwilligers kunnen we mensen over de hele wereld de kans geven om in hun eigen taal te leren. Jij kunt ons helpen meer mensen te bereiken door vrijwillig te starten met vertalen - meer informatie op [rpf.io/translate](https://rpf.io/translate). ---- save --- diff --git a/nl-NL/step_7.md b/nl-NL/step_7.md index f7d2f3c9..0febfed2 100644 --- a/nl-NL/step_7.md +++ b/nl-NL/step_7.md @@ -6,6 +6,6 @@ Als je lid bent van een club, waarom zou je je project dan niet delen met vriend Inspireer de Raspberry Pi Foundation community met je project! -Om je project in te dienen bij onze [Krachtige patroon - Community](https://wke.lt/w/s/yyNPQT){:target=blank} studio, graag [dit formulier](https://form.raspberrypi.org/f/community-project-submissions){:target="_blank"} invullen. +Om je project in te dienen bij onze [Krachtige patronen - Community](https://wke.lt/w/s/yyNPQT){:target=blank} studio, graag [dit formulier](https://form.raspberrypi.org/f/community-project-submissions){:target="_blank"} invullen. --- /task --- diff --git a/nl-NL/step_8.md b/nl-NL/step_8.md index d73f113d..32fb6e69 100644 --- a/nl-NL/step_8.md +++ b/nl-NL/step_8.md @@ -5,13 +5,3 @@ Je hebt het einde van het [Inleiding tot Python](https://projects.raspberrypi.or [[[python-coolest-projects]]] Je kunt onze [andere Python-projecten](https://projects.raspberrypi.org/nl-NL/projects?software%5B%5D=python) verkennen en ze uitproberen. - -*** - -Dit project werd vertaald door vrijwilligers: - -Christel Haex -Iny van Beuningen -Jeroen Wernsen - -Dankzij vrijwilligers kunnen we mensen over de hele wereld de kans geven om in hun eigen taal te leren. Jij kunt ons helpen meer mensen te bereiken door vrijwillig te starten met vertalen - meer informatie op [rpf.io/translate](https://rpf.io/translate). diff --git a/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/main.py b/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/main.py new file mode 100644 index 00000000..460a7900 --- /dev/null +++ b/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/main.py @@ -0,0 +1,38 @@ +#!/bin/python3 + +from p5 import * +from random import randint + + +def motif(): + global circle_size + for i in range(5): + ellipse(0, 0, circle_size / 5 * (5 - i), circle_size / 5 * (5 - i)) + + +def setup(): + size(400, 400) + print('🖌 Цей візерунок складається з багатьох кіл!') + + global circle_size + + circle_size = 50 + + +def draw(): + # Кольори візерунка + stroke(40, 35, 100) # блакитний + stroke_weight(2) # товстий контур + fill(200, 180, 128) # золотий + + translate(0, 0) # почати з верхнього лівого кута екрана + + if frame_count <= 16: # створює 16 рядків, а потім зупиняється + for row in range(frame_count): # анімує 1 рядок за раз + for shape in range(16): # створює рядок мотивів + motif() + translate(circle_size / 2, 0) + translate(-width, circle_size / 2) # переходить вниз, щоб почати новий рядок + + +run(frame_rate=3) diff --git a/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/project_config.yml b/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/project_config.yml new file mode 100644 index 00000000..486456f3 --- /dev/null +++ b/uk-UA/code/powerful_patterns_art_deco_wallpaper_example/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: шпалери у стилі ар-деко" +identifier: "art-deco-example" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_kek_lepis_sarawak/main.py b/uk-UA/code/powerful_patterns_kek_lepis_sarawak/main.py new file mode 100644 index 00000000..e5a8dba6 --- /dev/null +++ b/uk-UA/code/powerful_patterns_kek_lepis_sarawak/main.py @@ -0,0 +1,64 @@ +#!/bin/python3 + +from p5 import * +from time import * + +# На основі дивовижного малайзійського мистецтва тортів з геометричними візерунками, що називається кек-ляпіс саравак + + +def quadrant(): + # Вибери декілька яскравих кольорів для шарів торта + turquoise = Color(64, 224, 208) + gold = Color(255, 215, 0) + tomato = Color(255, 99, 71) + + # Джем скріплює шари між собою + jam = Color(255, 165, 0) + stroke(jam) + stroke_weight(2) # Зміни число, щоб змінити кількість джему + + # Дев'ять шарів торта: 3 кольори повторюються тричі + for i in range(3): + start_y = i * 60 # висота трьох шарів торту + fill(turquoise) + rect(0, start_y, 180, 20) + fill(gold) + rect(0, start_y + 20, 180, 20) + fill(tomato) + rect(0, start_y + 40, 180, 20) + + +def outer(): + # Торт загорнутий у зовнішній шар + yellowgreen = Color(154, 205, 50) + + no_fill() # Не закривай середину торту + stroke(yellowgreen) + stroke_weight(20) + rect(10, 10, 380, 380, 20) + + +def setup(): + size(400, 400) # створи площину для торта + background(255, 255, 255, 0) # прозорий фон + + +def draw(): + # Визнач чверті обороту, щоб твій код легко читався + quarter = radians(90) + + translate(200, 200) # почни з центру + + # Зроби нижню праву четвертинку торта, потім по черзі інші четвертинки за допомогою обертання (функція rotate()) + + if frame_count <= 4: # малює лише 4 четвертинки + for i in range(frame_count): + quadrant() + rotate(quarter) + + if frame_count == 5: # додає зовнішній шар + translate(-200, -200) # назад у верхній кут + outer() # зовнішній шар + + +run(frame_rate=5) # 5 кадрів за секунду diff --git a/uk-UA/code/powerful_patterns_kek_lepis_sarawak/project_config.yml b/uk-UA/code/powerful_patterns_kek_lepis_sarawak/project_config.yml new file mode 100644 index 00000000..12ca657e --- /dev/null +++ b/uk-UA/code/powerful_patterns_kek_lepis_sarawak/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: торт «Саравак»" +identifier: "repeated-patterns-example" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_mcewen_tartan_example/main.py b/uk-UA/code/powerful_patterns_mcewen_tartan_example/main.py new file mode 100644 index 00000000..fb6987e0 --- /dev/null +++ b/uk-UA/code/powerful_patterns_mcewen_tartan_example/main.py @@ -0,0 +1,77 @@ +#!/bin/python3 + +from p5 import * + + +def setup(): + size(400, 400) + + +def draw(): + lines = 10 * frame_count # Використовуй під час визначення ширини й довжини фігури для поступової анімації + + # Кольори тартану клану Макʼюєнів + # Кольори квадратів основи + BLUE = Color(83, 143, 200) # блакитний + GREEN = Color(78, 163, 162) # зелений + BASE_COLORS = [GREEN, BLUE] + + # Кольори перетинів + YELLOW = Color(155, 176, 135) # жовтий + RED = Color(155, 129, 113) # червоний + CROSS_COLORS = [YELLOW, RED] + + # Колір швів та накладання + GREY = Color(78, 99, 86) # сірий + + # Намалюй квадрати основи за допомогою GREEN та BLUE + no_stroke() + y_coordinate = 0 + squares = width/square_size + + for i in range(int(squares)): + gap = 0 + for j in range(int(squares)): + fill(BASE_COLORS[j % 2]) # GREEN і BLUE (зелений і блакитний) + rect(gap, y_coordinate, square_size, square_size) + gap = gap + square_size + y_coordinate = y_coordinate + square_size + + # Перетини + stroke(GREY) + + # Малює перехрестя жовтого і червоного кольорів (YELLOW і RED) + for i in range(4): + fill(YELLOW) + cross = square_size / 2 - 2 + for i in range(int(squares/2)): + fill(CROSS_COLORS[i % 2]) # YELLOW і RED (жовтий і червоний) + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + 2 * square_size + # Намалюй перетини для швів + no_fill() + cross = square_size + square_size / 2 - 2 + for i in range(int(squares)): + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + square_size + + # Намалюй сірі лінії, де матеріал нашаровується + no_stroke() + fill(GREY, 100) + gap = square_size - 4 + for i in range(int(squares)): + rect(gap, 0, 8, lines) + gap = gap + square_size + gap = square_size - 4 + for i in range(int(squares)): + rect(0, gap, lines, 8) + gap = gap + square_size + + +print('🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁢󠁳󠁣󠁴󠁿 Це тартан шотландського клану Макʼюенів 🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁧󠁢󠁳󠁣󠁴󠁿') +square_size = int( + input('Який має бути розмір 🏴󠁧󠁢󠁳󠁣󠁴󠁿тартану? 20, 50 або 100')) + +run(frame_rate=10) diff --git a/uk-UA/code/powerful_patterns_mcewen_tartan_example/project_config.yml b/uk-UA/code/powerful_patterns_mcewen_tartan_example/project_config.yml new file mode 100644 index 00000000..05beab8c --- /dev/null +++ b/uk-UA/code/powerful_patterns_mcewen_tartan_example/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: тартан клану Мак’юенів" +identifier: "mcewen-tartan-example" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_random_faces_example/main.py b/uk-UA/code/powerful_patterns_random_faces_example/main.py new file mode 100644 index 00000000..79f32090 --- /dev/null +++ b/uk-UA/code/powerful_patterns_random_faces_example/main.py @@ -0,0 +1,47 @@ +#!/bin/python3 + +from p5 import * +from random import randint + + +def draw_motif(): + orange = Color(191, 64, 191) # помаранчевий + brown = Color(200, 120, 0) # коричневий + green = Color(100, 155, 0) # зелений + fill(orange) + ellipse(200, 200, 200, 190) + fill(0) + # Очі + ellipse(160, 190, 30, 30) + ellipse(240, 190, 30, 30) + fill(255) + ellipse(165, 200, 10, 10) + ellipse(245, 200, 10, 10) + # Рот + 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() + # зміщення по ширині на чверть розміру обличчя + translate(randint(-50, 350), randint(-50, 350)) + scale(0.25, 0.25) # шляхи розміром у чверть + draw_motif() + pop_matrix() + + +run(frame_rate=10) diff --git a/uk-UA/code/powerful_patterns_random_faces_example/project_config.yml b/uk-UA/code/powerful_patterns_random_faces_example/project_config.yml new file mode 100644 index 00000000..94c3488c --- /dev/null +++ b/uk-UA/code/powerful_patterns_random_faces_example/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: випадкові обличчя" +identifier: "random-faces-example" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_spirals_example/main.py b/uk-UA/code/powerful_patterns_spirals_example/main.py new file mode 100644 index 00000000..7dbcd130 --- /dev/null +++ b/uk-UA/code/powerful_patterns_spirals_example/main.py @@ -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): # короткий ряд квадратів + rect(i * 5, 0, 5, 5) + + +def setup(): + size(400, 400) + stroke_weight(2) # товстий контур + background(255) + + +def draw(): + translate(200, 200) # почати з центру екрана + if frame_count < 150: + for i in range(frame_count): # анімує візерунок + motif() + rotate(5) # обертає мотив + translate(i, i) # переміщує мотив + + +run(frame_rate=10) # швидка анімація diff --git a/uk-UA/code/powerful_patterns_spirals_example/project_config.yml b/uk-UA/code/powerful_patterns_spirals_example/project_config.yml new file mode 100644 index 00000000..75f0e88e --- /dev/null +++ b/uk-UA/code/powerful_patterns_spirals_example/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: спіралі" +identifier: "spirals-pattern-example" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_starter/main.py b/uk-UA/code/powerful_patterns_starter/main.py new file mode 100644 index 00000000..e6c911a9 --- /dev/null +++ b/uk-UA/code/powerful_patterns_starter/main.py @@ -0,0 +1,20 @@ +#!/bin/python3 + +from p5 import * +from random import randint + + +def setup(): + # Розмісти тут код для одноразового запуску + size(400, 400) + background(255, 255, 255) + + +def draw(): + # Помісти тут код для запуску на кожному кадрі + fill(255, 0, 255) + rect(50, 50, 120, 100) + + +# Цей рядок запускає код +run(frame_rate=5) diff --git a/uk-UA/code/powerful_patterns_starter/project_config.yml b/uk-UA/code/powerful_patterns_starter/project_config.yml new file mode 100644 index 00000000..0a74c3c3 --- /dev/null +++ b/uk-UA/code/powerful_patterns_starter/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки" +identifier: "powerful-patterns-starter" +type: 'python' diff --git a/uk-UA/code/powerful_patterns_yakan_weaving_example/main.py b/uk-UA/code/powerful_patterns_yakan_weaving_example/main.py new file mode 100644 index 00000000..08e8e755 --- /dev/null +++ b/uk-UA/code/powerful_patterns_yakan_weaving_example/main.py @@ -0,0 +1,66 @@ +#!/bin/python3 + +from p5 import * +from math import random + + +def motif(): + motif_size = 100 + + # Кольори матеріалів + Orange = Color(254, 96, 1) # помаранчевий + PURPLE = Color(135, 18, 192) # фіолетовий + YELLOW = Color(243, 200, 19) # жовтий + BLUE = Color(83, 171, 176) # блакитний + + # Квадрати + fill(ORANGE) + rect(0, 0, motif_size/2, motif_size/2) + fill(PURPLE) + rect(50, 0, motif_size/2, motif_size/2) + fill(YELLOW) + rect(0, 50, motif_size/2, motif_size/2) + fill(BLUE) + rect(50, 50, motif_size/2, motif_size/2) + fill(PURPLE) + rect(0, 0, motif_size/4, motif_size/4) + fill(ORANGE) + rect(50, 0, motif_size/4, motif_size/4) + fill(BLUE) + rect(0, 50, motif_size/4, motif_size/4) + fill(YELLOW) + rect(50, 50, motif_size/4, motif_size/4) + + +def rotate_motif(): + for shape in range(5): # ряд фігур + push_matrix() # зберегти налаштування + rotate(radians(45)) # повернути фігуру на 45 градусів + motif() + pop_matrix() # повернутися до збережених налаштувань + translate(motif_width, 0) # переміститися по горизонталі + + +def setup(): + size(400, 400) + background(250, 5, 94) # рожевий + no_stroke() + print('Це 🇵🇭 яканське плетіння') + + +def draw(): + global motif_width + motif_width = 150 + + translate(-motif_width/2, -motif_width/2) # щоб почати з половинками мотиву + + if frame_count < 20: # максимальна кількість рядків + for row in range(frame_count): + rotate_motif() + if row / 2 == 0: # щоб змістити візерунок на наступному рядку + translate(-motif_width * 5 + 75, 80) + else: + translate(-motif_width * 5 - 75, 80) + + +run(frame_rate=3) diff --git a/uk-UA/code/powerful_patterns_yakan_weaving_example/project_config.yml b/uk-UA/code/powerful_patterns_yakan_weaving_example/project_config.yml new file mode 100644 index 00000000..5516c9bc --- /dev/null +++ b/uk-UA/code/powerful_patterns_yakan_weaving_example/project_config.yml @@ -0,0 +1,3 @@ +name: "Барвисті візерунки: яканське плетіння" +identifier: "yakan-weaving-example" +type: 'python' diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml index 8db28a3a..02265a3e 100644 --- a/uk-UA/meta.yml +++ b/uk-UA/meta.yml @@ -1,23 +1,24 @@ --- -title: Потужні візерунки +title: Барвисті візерунки hero_image: images/banner.png -description: Створи витвір мистецтва, яке буде надихати та масштабуй його, використовуючи повторення візерунків +description: Зроби витвір мистецтва, який можна масштабувати з використанням повторюваних візерунків +meta_title: Проєкти з кодування для дітей і підлітків | Барвисті візерунки +meta_description: Вивчай Python з проєктами кодування Raspberry Pi Foundation для дітей і підлітків. Створи твір мистецтва за допомогою Python, використовуючи повторювані візерунки. version: 4 listed: true copyedit: true last_tested: "2021-10-06" steps: - - title: Ти зробиш - - title: Свою ідею - - title: Будуй та тестуй - Мотив + - title: Що ти зробиш + - title: Початок роботи completion: - engaged - - title: Розширюй та тестуй - Візерунок + - title: Створи мотив completion: - internal - - title: Контрольний список + - title: Зроби візерунок completion: - external - - title: Вдосконалення твого проєкту - - title: Поділитися - - title: Що далі? + - title: Додаткове завдання + challenge: true + - title: Що ти тепер вмієш? diff --git a/uk-UA/python-comments.txt b/uk-UA/python-comments.txt index c4657a10..8b34b0da 100644 --- a/uk-UA/python-comments.txt +++ b/uk-UA/python-comments.txt @@ -2,150 +2,8 @@ Спробуй різні числа, щоб змінити колір -Запуск перенесення - -Скинути перенесення - Половина розміру -Розмісти тут код для одноразового запуску - -Помісти тут код для запуску на кожному кадрі - -За допомогою цього ти зможеш запустити свій код - -Вибери декілька яскравих кольорів для шарів торта - -Джем скріплює шари між собою - -Зміни число, щоб змінити кількість джему - -Дев'ять шарів торта, повторюючи 3 кольори по 3 рази - -висота 3-х блоків торта - -Торт обгортається зовнішнім шаром - -Зроби кути торта заокругленими! - -зробіть торт квадратним - -прозорий фон - -5 кадрів на секунду - -Визначення чверті обороту, щоб наш код легко читався - -початок з центру - -Зроби нижню праву четвертинку торта, потім по черзі інші четвертинки - -малювання до 4-х квадрантів - -додати зовнішній шар - -назад до верхнього кута - -зовнішній шар - -Визначення для сумісності з бібліотекою p5py - -Фігура - -Шрифти - -Текст - -Колір - -Зображення - -Довкілля - -Перетворення - -Клавіатура - -невеликий рядок з квадратів - -швидка анімація - -жирне обведення - -починати з центру екрана - -анімація візерунка - -перевертає мотив - -переміщує мотив - -Очі - -Рот - -зміщення по ширині на чверть розміру обличчя - -чверть розміру шляху - -Кольори візерунка - -синій - -gold - -почати з лівого верхнього кута екрану - -створює 16 рядків, потім зупиняється - -анімація по одному рядку за раз - -створення рядка з мотивів - -переміщення вниз, щоб створити наступний ряд - -Кольори матеріалів - -Квадрати - -ряд фігур - -збереження налаштувань - -поворот фігури на 45 градусів - -повернення до збережених налаштувань - -переміщення по горизонталі - -рожевий - -почати з половинок мотивів - -максимальна кількість рядів - -зміщення візерунка на наступному рядку - -Швидкість руху ширини/довжини фігури для створення анімації - -Кольори Тартана Макьюєна - -Базові кольори квадратів - -Кольори перетинів - -Колір швів та накладання - -Намалюй основу за допомогою GREEN та BLUE квадратів, які чергуються між собою - -GREEN та BLUE - -Перетини - -Малювання YELLOW та RED перехресть, які чергуються між собою - -YELLOW та RED - -Намалюй перетини для швів +Запуск перенесення -Намалюй сірі лінії в місцях перекриття матеріалів +Скинути перенесення \ No newline at end of file diff --git a/uk-UA/python-translatable.txt b/uk-UA/python-translatable.txt index 3d4bf388..89cb1708 100644 --- a/uk-UA/python-translatable.txt +++ b/uk-UA/python-translatable.txt @@ -1,71 +1,3 @@ -quadrant - -turquoise - -gold - -tomato - -jam - -start_y - -зовнішній - -yellowgreen - -quarter - -motif - draw_motif -orange - -brown - -green - -circle_size - -У цьому арті використовується багато кружечків! - -motif_size - -ORANGE - -PURPLE - -YELLOW - -BLUE - -Це 🇵🇭 Ткацтво з Якану - -motif_width - -Це Тартан Макьюєна - -square_size - -Який розмір тартана ти хочеш? 20, 50 або 100 - -lines - -GREEN - -BASE_COLORS - -RED - -CROSS_COLORS - -GREY - -y_coordinate - -squares - -gap - -хрест +BLUE \ No newline at end of file diff --git a/uk-UA/solutions/.keep b/uk-UA/solutions/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/uk-UA/solutions/Art deco wallpaper.zip b/uk-UA/solutions/Art deco wallpaper.zip deleted file mode 100644 index 0e3cc9e5..00000000 Binary files a/uk-UA/solutions/Art deco wallpaper.zip and /dev/null differ diff --git a/uk-UA/solutions/Art deco wallpaper/main.py b/uk-UA/solutions/Art deco wallpaper/main.py new file mode 100644 index 00000000..8c21d73b --- /dev/null +++ b/uk-UA/solutions/Art deco wallpaper/main.py @@ -0,0 +1,37 @@ +#!/bin/python3 + +from p5 import * +from math import random +from random import randint + +def motif(): + global circle_size + for i in range(5): + ellipse(0, 0, circle_size / 5 * (5 - i), circle_size / 5 * (5 - i)) + +def setup(): + size(400, 400) + frame_rate(3) + print('🖌 Цей візерунок складається з багатьох кіл!') + + global circle_size + + circle_size = 50 + +def draw(): + + # Кольори візерунка + stroke(40, 35, 100) # блакитний + stroke_weight(2) # товстий контур + fill(200, 180, 128) # золотий + + translate(0,0) # почати з верхнього лівого кута екрана + + if frame_count <= 16: # створює 16 рядків, а потім зупиняється + for row in range(frame_count): # анімує 1 рядок за раз + for shape in range(16): # створює рядок мотивів + motif() + translate(circle_size / 2, 0) + translate(-width, circle_size / 2) # переходить вниз, щоб почати новий рядок + +run() \ No newline at end of file diff --git a/uk-UA/solutions/Art deco wallpaper/p5.py b/uk-UA/solutions/Art deco wallpaper/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/Art deco wallpaper/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/solutions/Face mask pattern.zip b/uk-UA/solutions/Face mask pattern.zip deleted file mode 100644 index bd9fbc8b..00000000 Binary files a/uk-UA/solutions/Face mask pattern.zip and /dev/null differ diff --git a/uk-UA/solutions/Face mask pattern/main.py b/uk-UA/solutions/Face mask pattern/main.py new file mode 100644 index 00000000..38dc40be --- /dev/null +++ b/uk-UA/solutions/Face mask pattern/main.py @@ -0,0 +1,46 @@ +#!/bin/python3 + +from p5 import * +from random import randint + +def draw_motif(): + orange = сolor(191, 64, 191) # помаранчевий + brown = color(200, 120, 0) # коричневий + green = color(100, 155, 0) # зелений + fill(orange) + ellipse(200, 200, 200, 190) + fill(0) + # Очі + ellipse(160, 190, 30, 30) + ellipse(240, 190, 30, 30) + fill(255) + ellipse(165, 200, 10, 10) + ellipse(245, 200, 10, 10) + # Рот + noFill() + stroke(255, 255, 255) + ellipse(150, 250, 30, 30) + ellipse(250, 250, 30, 30) + fill(255, 255, 255) + noStroke() + rect(150, 230, 100, 40) + fill(108, 200, 206) + rect(152, 235, 96, 30) + + +def setup(): + size(400, 400) + background(255) + no_stroke() + frame_rate(10) + + +def draw(): + push_matrix() + translate(randint(-50, 350), randint(-50, 350)) # oзміщення по ширині на чверть розміру обличчя + scale(0.25) # шляхи розміром у чверть + draw_motif() + pop_matrix() + + +run() \ No newline at end of file diff --git a/uk-UA/solutions/Face mask pattern/p5.py b/uk-UA/solutions/Face mask pattern/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/Face mask pattern/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/solutions/Fibonacci-sequence.zip b/uk-UA/solutions/Fibonacci-sequence.zip deleted file mode 100644 index 96509ea8..00000000 Binary files a/uk-UA/solutions/Fibonacci-sequence.zip and /dev/null differ diff --git a/uk-UA/solutions/Fibonacci-sequence/main.py b/uk-UA/solutions/Fibonacci-sequence/main.py new file mode 100644 index 00000000..5532151c --- /dev/null +++ b/uk-UA/solutions/Fibonacci-sequence/main.py @@ -0,0 +1,43 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def setup(): + size(800, 800) + frame_rate(2) + stroke_weight(2) + background(255) + ellipseMode(CORNER) + +def draw(): + + BLUE = color(0, 0, 255) # блакитний + BLACK = color(0, 0, 0) # чорний + translate(width/2, height/2) + + # Мотив + rect(0, 0, 1, 1) + arc(0, 0, 1, 1, radians(90), radians(180)) + translate(1,1) + rotate(radians(270)) + + first = 0 + second = 1 + next = first + second + + # Візерунок + if frame_count < 20: + for i in range (frame_count): + stroke(BLACK) + rect(0, 0, next, next) + no_fill() + stroke(BLUE) + arc(0, -next, next*2, next*2, radians(90), radians(180)) + translate(next,next) + rotate(radians(270)) + first = second + second = next + next = first + second + +run() \ No newline at end of file diff --git a/uk-UA/solutions/Fibonacci-sequence/p5.py b/uk-UA/solutions/Fibonacci-sequence/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/Fibonacci-sequence/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/solutions/Kek lapis Sarawak.zip b/uk-UA/solutions/Kek lapis Sarawak.zip deleted file mode 100644 index 951d1aba..00000000 Binary files a/uk-UA/solutions/Kek lapis Sarawak.zip and /dev/null differ diff --git a/uk-UA/solutions/Kek lapis Sarawak/draw.py b/uk-UA/solutions/Kek lapis Sarawak/draw.py new file mode 100644 index 00000000..c43e19f6 --- /dev/null +++ b/uk-UA/solutions/Kek lapis Sarawak/draw.py @@ -0,0 +1,134 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() diff --git a/uk-UA/solutions/Kek lapis Sarawak/main.py b/uk-UA/solutions/Kek lapis Sarawak/main.py new file mode 100644 index 00000000..b3311c22 --- /dev/null +++ b/uk-UA/solutions/Kek lapis Sarawak/main.py @@ -0,0 +1,67 @@ +#!/bin/python3 + +from draw import * +from time import * + +# На основі дивовижного малайзійського мистецтва тортів з геометричними візерунками, що називається кек-ляпіс саравак + +def quadrant(): + + # Вибери декілька яскравих кольорів для шарів торта + turquoise = color(64, 224, 208) # бірюзовий + gold = color(255, 215, 0) # золотий + tomato = color(255, 99, 71) # червоний + + # Джем скріплює шари між собою + jam = color(255, 165, 0) + stroke(jam) + stroke_weight(2) # Зміни число, щоб змінити кількість джему + + # Дев'ять шарів торта: 3 кольори повторюються тричі + for i in range(3): + start_y = i * 60 # висота трьох шарів торту + fill(turquoise) + rect(0, start_y, 180, 20) + fill(gold) + rect(0, start_y + 20, 180, 20) + fill(tomato) + rect(0, start_y + 40, 180, 20) + + +def outer(): + + # Торт загорнутий у зовнішній шар + yellowgreen = Color(154, 205, 50) + + no_fill() # Не закривай середину торту + stroke(yellowgreen) + stroke_weight(20) + rect(10, 10, 380, 380, 20) + + +def setup(): + size(400, 400) # створи площину для торта + background(255, 255, 255, 0) # прозорий фон + frame_rate(5) # 5 кадрів за секунду + + +def draw(): + + # Визнач чверті обороту, щоб твій код легко читався + quarter = radians(90) + + translate(200, 200) # почни з центру + + # Зроби нижню праву четвертинку торта, потім по черзі інші четвертинки за допомогою обертання (функція rotate()) + + if frame_count <= 4: # малює лише 4 четвертинки + for i in range(frame_count): + quadrant() + rotate(quarter) + + if frame_count == 5: # додає зовнішній шар + translate(-200, -200) # назад у верхній кут + outer() # зовнішній шар + + +run() diff --git a/uk-UA/solutions/McEwen tartan.zip b/uk-UA/solutions/McEwen tartan.zip deleted file mode 100644 index 3e88394e..00000000 Binary files a/uk-UA/solutions/McEwen tartan.zip and /dev/null differ diff --git a/uk-UA/solutions/McEwen tartan/main.py b/uk-UA/solutions/McEwen tartan/main.py new file mode 100644 index 00000000..93759bb3 --- /dev/null +++ b/uk-UA/solutions/McEwen tartan/main.py @@ -0,0 +1,79 @@ +#!/bin/python3 + +from p5 import * + +def setup(): + size(400, 400) + frame_rate(10) + print('🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁢󠁳󠁣󠁴󠁿 Це тартан шотландського клану Макʼюенів 🏴󠁧󠁢󠁳󠁣󠁴󠁿󠁧󠁢󠁳󠁣󠁴󠁿') + + global square_size + square_size = int(input('Який має бути розмір 🏴󠁧󠁢󠁳󠁣󠁴󠁿тартану? 20, 50 або 100')) + +def draw(): + + lines = 10 * frame_count # Використовуй під час визначення ширини й довжини фігури для поступової анімації + + # Кольори тартану клану Макʼюєнів + # Кольори квадратів основи + BLUE = color(83, 143, 200) # блакитний + GREEN = color(78, 163, 162) # зелений + BASE_COLORS = [GREEN, BLUE] + + # Кольори перетинів + YELLOW = color(155, 176, 135) # жовтий + RED = color(155, 129, 113) # червоний + CROSS_COLORS = [YELLOW, RED] + + # Колір швів та накладання + GREY = color(78, 99, 86) # сірий + + # Намалюй квадрати основи за допомогою GREEN та BLUE + no_stroke() + y_coordinate = 0 + squares = width/square_size + + for i in range (int(squares)): + gap = 0 + for j in range (int(squares)): + fill(BASE_COLORS[j % 2]) # GREEN і BLUE (зелений і блакитний) + rect(gap, y_coordinate, square_size, square_size) + gap = gap + square_size + y_coordinate = y_coordinate + square_size + + # Перетини + stroke(GREY) + + # Малює перехрестя жовтого і червоного кольорів (YELLOW і RED) + for i in range (4): + fill(YELLOW) + cross = square_size / 2 - 2 + for i in range (int(squares/2)): + fill(CROSS_COLORS[i % 2]) # YELLOW і RED (жовтий і червоний) + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + 2 * square_size + # Намалюй перетини для швів + no_fill() + cross = square_size + square_size / 2 - 2 + for i in range (int(squares)): + rect(cross, 0, 4, lines) + rect(0, cross, lines, 4) + cross = cross + square_size + + # Намалюй сірі лінії, де матеріал нашаровується + no_stroke() + fill(GREY, 100) + gap = square_size - 4 + for i in range (int(squares)): + rect(gap, 0, 8, lines) + gap = gap + square_size + gap = square_size - 4 + for i in range (int(squares)): + rect(0, gap, lines, 8) + gap = gap + square_size + +run() + + + diff --git a/uk-UA/solutions/McEwen tartan/p5.py b/uk-UA/solutions/McEwen tartan/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/McEwen tartan/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/solutions/Spirals/main.py b/uk-UA/solutions/Spirals/main.py new file mode 100644 index 00000000..3b0b4172 --- /dev/null +++ b/uk-UA/solutions/Spirals/main.py @@ -0,0 +1,30 @@ +#!/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): # короткий ряд квадратів + rect(i * 5, 0, 5, 5) + +def setup(): + size(400, 400) + frame_rate(10) # швидка анімація + stroke_weight(2) # товстий контур + background(255) + +def draw(): + translate(200, 200) # почати з центру екрана + if frame_count < 150: + for i in range(frame_count): # анімує візерунок + motif() + rotate(5) # обертає мотив + translate(i,i) # переміщує мотив + +run() \ No newline at end of file diff --git a/uk-UA/solutions/Spirals/p5.py b/uk-UA/solutions/Spirals/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/Spirals/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/solutions/Yakan Weaving.zip b/uk-UA/solutions/Yakan Weaving.zip deleted file mode 100644 index ab823312..00000000 Binary files a/uk-UA/solutions/Yakan Weaving.zip and /dev/null differ diff --git a/uk-UA/solutions/Yakan Weaving/main.py b/uk-UA/solutions/Yakan Weaving/main.py new file mode 100644 index 00000000..399c20db --- /dev/null +++ b/uk-UA/solutions/Yakan Weaving/main.py @@ -0,0 +1,64 @@ +#!/bin/python3 + +from p5 import * +from math import random + +def motif(): + motif_size = 100 + + #Кольори матеріалів + ORANGE = color(254, 96, 1) # помаранчевий + PURPLE = color(135, 18, 192) # фіолетовий + YELLOW = color(243, 200, 19) # жовтий + BLUE = color(83, 171, 176) # блакитний + + # Квадрати + fill(ORANGE) + rect(0, 0, motif_size/2, motif_size/2) + fill(PURPLE) + rect(50, 0, motif_size/2, motif_size/2) + fill(YELLOW) + rect(0, 50, motif_size/2, motif_size/2) + fill(BLUE) + rect(50, 50, motif_size/2, motif_size/2) + fill(PURPLE) + rect(0, 0, motif_size/4, motif_size/4) + fill(ORANGE) + rect(50, 0, motif_size/4, motif_size/4) + fill(BLUE) + rect(0, 50, motif_size/4, motif_size/4) + fill(YELLOW) + rect(50, 50, motif_size/4, motif_size/4) + +def rotate_motif(): + + for shape in range(5): # ряд фігур + push_matrix() # зберегти налаштування + rotate(radians(45)) # повернути фігуру на 45 градусів + motif() + popMatrix() # повернутися до збережених налаштувань + translate(motif_width, 0) # переміститися по горизонталі + +def setup(): + size(400, 400) + frame_rate(3) + background(250, 5, 94) # рожевий + no_stroke() + print('Це 🇵🇭 яканське плетіння') + +def draw(): + + global motif_width + motif_width = 150 + + translate(-motif_width/2, -motif_width/2) # щоб почати з половинками мотиву + + if frame_count < 20: # максимальна кількість рядків + for row in range(frame_count): + rotate_motif() + if row % 2 == 0: # щоб змістити візерунок на наступному рядку + translate(-motif_width * 5 + 75, 80) + else: + translate(-motif_width * 5 - 75, 80) + +run() diff --git a/uk-UA/solutions/Yakan Weaving/p5.py b/uk-UA/solutions/Yakan Weaving/p5.py new file mode 100644 index 00000000..51f5c098 --- /dev/null +++ b/uk-UA/solutions/Yakan Weaving/p5.py @@ -0,0 +1,135 @@ +# Визначення для сумісності з бібліотекою p5py +from processing import * +import __main__ + +# Фігура +from processing import rectMode as rect_mode +from processing import ellipseMode as ellipse_mode +from processing import strokeWeight as stroke_weight +from processing import strokeCap as stroke_cap +from processing import strokeJoin as stroke_join +from processing import noStroke as no_stroke +from processing import noFill as no_fill + +# Шрифти +from processing import createFont as create_font +from processing import loadFont as load_font +from processing import textFont as text_font + +# Текст +from processing import textAlign as text_align +from processing import textLeading as text_leading +from processing import textMode as text_mode +from processing import textSize as text_size +from processing import textWidth as text_width + +# Колір +from processing import blendColor as blend_color +from processing import lerpColor as lerp_color +from processing import color as Color + +# Зображення +from processing import createImage as create_image +from processing import imageMode as image_mode +from processing import loadImage as load_image +from processing import noTint as no_tint +from processing import requestImage as request_image + +# Довкілля +from processing import frameRate as frame_rate +from processing import noCursor as no_cursor +from processing import noLoop as no_loop + +# Перетворення +from processing import applyMatrix as apply_matrix +from processing import popMatrix as pop_matrix +from processing import printMatrix as print_matrix +from processing import pushMatrix as push_matrix +from processing import resetMatrix as reset_matrix +from processing import rotateX as rotate_x +from processing import rotateY as rotate_y +from processing import pushStyle as push_style +from processing import popStyle as pop_style + +from processing import run as main_run + +# Клавіатура + +def mousePressed(): + if hasattr(__main__, "mouse_pressed"): + mouse_pressed = getattr(__main__, "mouse_pressed") + mouse_pressed() + +def mouseReleased(): + if hasattr(__main__, "mouse_released"): + mouse_released = getattr(__main__, "mouse_released") + mouse_released() + +__main__.mouse_x = 0 +__main__.mouse_y = 0 +__main__.mouse_px = 0 +__main__.mouse_py = 0 +__main__.frame_count = 0 +__main__.frame_rate = 60 + +def mouseMoved(): + __main__.mouse_x = mouse.x + __main__.mouse_y = mouse.y + __main__.mouse_px = mouse.px + __main__.mouse_py = mouse.py + if hasattr(__main__, "mouse_moved"): + mouse_moved = getattr(__main__, "mouse_moved") + mouse_moved() + +def mouseDragged(): + if hasattr(__main__, "mouse_dragged"): + mouse_dragged = getattr(__main__, "mouse_dragged") + mouse_dragged() + +def new_draw(): + __main__.frame_count = frameCount + frameRate = __main__.frame_rate + old_draw() + +def run(): + global old_draw + old_draw = __main__.draw + __main__.draw = new_draw + main_run() + +def grid(): + pushMatrix() + stroke(200) + fill(0) + line(0, height/2, width, height/2) + line(width/2, 0, width/2, height) + x_coords = [0, width/2, width] + y_coords = [0, height/2, height] + + for x in x_coords: + for y in y_coords: + show_coord(x, y) + + popMatrix() + +def show_coord(x, y): + if x == width: + x_align = RIGHT + elif x == 0: + x_align = LEFT + else: + x_align = CENTER + + if y == height: + y_align = BASELINE + elif y == 0: + y_align = TOP + else: + y_align = CENTER + + pushStyle() + fill(100) + text_align(x_align, y_align) + text('(' + str(int(x)) + ', ' + str(int(y)) + ')', x, y) + popStyle() + diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md index 0b17f516..86ba70b5 100644 --- a/uk-UA/step_1.md +++ b/uk-UA/step_1.md @@ -1,108 +1,26 @@ -## Ти зробиш -Створиш витвір мистецтва, яке буде надихати та зможеш це масштабувати, використовуючи повторення візерунків. - -Твій потужний візерунок повинен відповідати **короткому опису проєкту**. - -

-Короткий опис проєкту визначає ціль проєкту. Це нагадує місію, яку потрібно виконати. -

- -Зможеш: -+ Намалювати та розташувати геометричні фігури, щоб створити базовий візерунок (або "мотив") -+ Використовувати цикли `for`, щоб `translate` візерунок для заповнення всього екрану -+ Використовувати `frame_rate` та `frame_count`, щоб анімувати створення візерунка - -

Візерунки оточують нас всюди: в тканинах, природі, мистецтві, культурі та дизайні. Початкова точка візерунка називається мотивом - це елемент, який можна повторювати та поєднувати, створюючи безліч різних візерунків. -

+Зроби витвір мистецтва за допомогою повторюваних візерунків. --- no-print --- ---- task --- - -
-
- -### Грати ▶️ - -Запусти цей приклад та подумай над мотивом, який повторюється. Як ти охарактеризуєш те, що відбувається в анімації? - -**Малайзійський листковий торт**: [Подивитись код](https://trinket.io/python/e03197361d){:target="_blank"} -
- -
- ---- /task --- - -
- -###КОРОТКИЙ ОПИС ПРОЄКТУ: Створи **потужний візерунок**. -
- -Тобі треба обов'язково: -+ Намалювати та розташувати геометричні фігури для створення базового візерунка -+ Використовувати цикли для повторення візерунка, щоб заповнити весь екран -+ Анімувати процес створення візерунка - -Також, ти можеш: -+ Використовувати насичені або виразні кольори -+ Черпати натхнення зі своєї або іншої популярної культури -+ Отримати від користувача вхідні дані, щоб змінити розмір візерунка -+ Додати текст та емодзі, щоб вивести більше деталей про твоє мистецтво -+ Переставляти візерунок, щоб створювати додаткові варіації -
- -### Отримай ідеї 💭 - ---- task --- - -Запусти ці приклади проєктів, щоб отримати ідеї для твого візерунка. - -З яких фігур: кружечків, овалів, квадратиків, прямокутників та трикутників складаються мотиви?: - -**Спіраль**: [Подивитись код](https://trinket.io/python/feca09e90f){:target="_blank"} -
- -
- -**Випадкові обличчя**: [Подивитись код](https://trinket.io/python/bfadb0acb8){:target="_blank"} -
- -
- -**Шпалери в стилі арт-деко**: [Подивитись код](https://trinket.io/python/2aa6f09625){:target="_blank"} -
- -
- -**Ткацтво з Якану**: [Подивитись код](https://trinket.io/python/84b908c76c){:target="_blank"} -
- -
- ---- /task --- + --- /no-print --- --- print-only --- -Переглянь ці приклади та задумайся про їх мотив, який повторюється. Як створювалися ці візерунки за допомогою кружечків, овалів, квадратиків, прямокутників та трикутників? +[Спіралі](https://editor.raspberrypi.org/uk-UA/projects/spirals-pattern-example) +![Завершений проєкт «Спіралі».](images/spirals.png) + +[Випадкові обличчя](https://editor.raspberrypi.org/uk-UA/projects/random-faces-example) +![Завершений проєкт «Випадкові обличчя».](images/random_faces.png) + +[Ар-деко](https://editor.raspberrypi.org/uk-UA/projects/art-deco-example) +![Завершений проєкт «Ар-деко».](images/art_deco.png) -![Завершений проєкт Малайзійський листковий торт.](images/kek.png) -Ознайомитися з проєктом Малайзійський листковий торт можна тут https://trinket.io/python/e03197361d -![Complete Spirals project.](images/spirals.png) -Ознайомитися з проєктом Спіраль можна тут https://trinket.io/python/feca09e90f -![Complete Random faces project.](images/random_faces.png) -Ознайомитися з проєктом Випадкові обличчя можна тут https://trinket.io/python/bfadb0acb8 -![Complete Art deco project.](images/art_deco.png) -Ознайомитися з проєктом Шпалери в стилі арт-деко можна тут https://trinket.io/python/2aa6f09625 -![Complete Yakan weaving project.](images/yakan.png) -Ознайомитися з проєктом Ткацтво з Якану можна тут https://trinket.io/python/84b908c76c +[Яканське плетіння](https://editor.raspberrypi.org/uk-UA/projects/yakan-weaving-example) +![Завершений проєкт «Яканське плетіння».](images/yakan.png) --- /print-only --- diff --git a/uk-UA/step_2.md b/uk-UA/step_2.md index eee5b641..ce010bd4 100644 --- a/uk-UA/step_2.md +++ b/uk-UA/step_2.md @@ -1,48 +1,8 @@ -## Свою ідею - -Використовуй цей крок, щоб створити план свого потужного візерунка. Ти можеш планувати, просто думаючи, майструючи, малюючи або пишучи - як завгодно! - -![Анімований gif з трьома різними прикладами з використанням різних форм для створення мотивів та анімації для зростання візерунка.](images/ideas-1.gif) - -

Візерунки часто мають культурне чи релігійне значення. Певні геометричні фігури та їх положення можуть мати символічне або сакральне значення. Неважливо, чи є візерунок в архітектурі, тканині, мистецтві, кулінарії або чомусь іншому, процес створення візерунка також може бути важливим.

- -### Для чого ти робиш свій потужний візерунок? +## Початок роботи --- task --- -Подумай, з якою метою ти створюєш візерунок. - -Це може бути: -- Висловити щось важливе зі своєї культури або культури своєї сім'ї -- Відтворити геометричний візерунок, який щось для тебе означає -- Щось, що ти створюєш разом з групою людей, щоб надіслати певне повідомлення (наприклад, ковдру) -- Показати щось захоплююче про своє хобі (наприклад, мистецтво, наука, природа, музика) - -**Порада:** Візерунки скрізь! Ти можеш шукати натхнення у своєму реальному оточенні або в інтернеті, шукаючи візерунки. - ---- /task --- - -

Окрім символічного значення, візерунки відображають математику, яка нас оточує. Математика допомагає нам зрозуміти навколишній світ, і ми можемо знаходити математичні закономірності в мистецтві, літературі та природі.

- -### Для кого вона буде призначена? - ---- task --- - -Подумай, для кого ти будеш створювати свій візерунок (твоя **аудиторія**). - -Яке значення має твій візерунок? Чи означають кольори, форми або спосіб повторення візерунка щось особливе для тебе або твоєї аудиторії? - -Поділись своїм візерунком - це чудовий спосіб висловити щось про себе або свою культуру. - -Якщо ти створюєш візерунок разом з групою, чи повинен твій мотив бути визначеного розміру або форми, щоб він поєднувався з іншими частинами більшого візерунка? - ---- /task --- - -### З чого почати - ---- task --- - -Відкрий [Потужні візерунки - стартовий проєкт](https://trinket.io/python/5d9a168d73){:target=blank } та натисни на кнопку Remix. +Відкрий [стартовий проєкт «Барвисті візерунки»](https://editor.raspberrypi.org/uk-UA/projects/powerful-patterns-starter){:target="_blank"}. --- /task --- @@ -50,84 +10,29 @@ --- task --- -Додай код до `setup()`, щоб підготувати свій проєкт. - ---- collapse --- - ---- -title: Налаштування розміру екрана під час запуску програми ---- - -**Обирай:** Встанови розмір, відповідно до розміру візерунка, який ти хочеш створити. Ти завжди зможеш змінити це пізніше, по мірі розвитку твого проєкту. +Вибери розмір і колір тла. --- code --- --- language: python -filename: main.py - setup() line_numbers: true line_number_start: 6 -line_highlights: 7 +line_highlights: 7-8 --- def setup(): - size(400, 400) #Вибери розмір + size(400, 400) # Вибери розмір + background(255, 255, 255) # Спробуй різні числа, щоб змінити колір --- /code --- ---- /collapse --- - ---- collapse --- - ---- -title: Налаштування кольору фону під час запуску програми ---- - -Подумай, як ти хочеш намалювати свій фон. Ти можеш: -+ Додати код до `setup()`, щоб фон малювався один раз при запуску проєкту -+ Додати код до `draw()`, щоб фон малювався щоразу при запуску функції `draw()` - ---- code --- ---- -language: python -filename: main.py - setup() -line_numbers: true -line_number_start: 9 -line_highlights: 9 ---- - background(255, 255, 255) #Спробуй різні числа, щоб змінити колір - ---- /code --- - ---- /collapse --- - -[[[generic-theory-simple-colours]]] - --- /task --- --- task --- -**Налагодження:** Можливо, у твоєму проєкті знайдуться помилки, які потрібно буде виправити. Ось деякі поширені помилки. - ---- collapse --- - ---- -title: Я змінив(-ла) розмір та колір, але область виводу залишилася такою самою ---- - -Після внесення змін до коду, тобі потрібно зробити `run` свого проєкту, щоб побачити зміни в області виводу. - ---- /collapse --- - ---- collapse --- - ---- -title: Я спробував(-ла) різні цифри, але колір фону не змінюється ---- - -Максимальне значення для червоного, зеленого, або синього - `255`. Переконайся, що всі значення кольору для твого фону `background` знаходяться між `0` та `255`. +**Протестуй:** запусти свій проєкт і поглянь, що змінилося. ---- /collapse --- +Максимальне значення для червоного, зеленого, або синього - `255`. Переконайся, що всі значення кольору для тла `background` знаходяться між `0` та `255`. --- /task --- ---- save --- diff --git a/uk-UA/step_3.md b/uk-UA/step_3.md index 5490bc3a..52ff99e9 100644 --- a/uk-UA/step_3.md +++ b/uk-UA/step_3.md @@ -1,31 +1,27 @@ -## Будуй та тестуй - Мотив +## Створи мотив
-Настав час створити мотив - перший елемент твого візерунка. +Більшість візерунків мають один елемент («мотив»), який повторюється багато разів і таким чином створює візерунок.
-![Приклад мотиву з використанням різних форм для створення мотиву.](images/motif.png){:width="300px"} +![Приклад мотиву з використанням різних форм.](images/motif.png){:width="300px"}
-Процес створення твого мотиву нагадує те, що часто роблять комп'ютерні вчені, коли вони створюють програму або вирішення якоїсь проблеми. Цей процес має назву **декомпозиція**. Ти будеш використовувати декомпозицію для створення свого мотиву. - -

Декомпозиція - це розбиття чогось на невеликі частини, які легше зрозуміти. Це означає, що ти можеш створювати візерунок по одній частині, поки він не буде завершений.

- -Уяви або подивись на візерунок, який ти хочеш створити. Як можна розбити його на один єдиний елемент (мотив), який повторюється? - -У цьому прикладі візерунок шпалер в стилі арт-деко розбитий на базову сукупність фігур (п'ять кіл, накладених один на одного), з яких складається мотив: +--- task --- -![Мотив з п'яти кіл поруч із зображенням завершеного візерунка в стилі ар-деко з багатьма копіями мотиву.](images/motif-pattern.png) +Намалюй якісь фігури, щоб створити свій мотив. Якщо тобі потрібна допомога, прочитай поради внизу сторінки. -**Порада:** Не забувай тестувати свій проєкт кожного разу, коли щось додаєш. Набагато простіше знайти та виправити помилки до того, як внести нові зміни. +--- /task --- --- task --- -Ти здобув(-ла) дійсно дуже корисні навички. Ось нагадування, яке допоможе тобі створити свій мотив: +**Протестуй:** запусти код і подивись, як виглядає твій мотив. -### Фігури та зображення +--- /task --- + +### Фігури [[[processing-python-ellipse]]] @@ -33,12 +29,9 @@ [[[processing-python-triangle]]] -[[[processing-add-image]]] ### Кольори та ефекти -[[[generic-theory-simple-colours]]] - [[[processing-opacity]]] [[[processing-stroke]]] @@ -57,53 +50,36 @@ [[[generic-python-for-loop-repeat]]] ---- /task --- - ---- task --- - -**Тест:** Покажи комусь свій проєкт та отримай зворотний зв'язок. Ти хочеш внести якісь зміни у свій мотив? - ---- /task --- - ---- task --- - -**Налагодження:** Можливо, у твоєму проєкті знайдуться помилки, які потрібно буде виправити. Ось деякі поширені помилки. +### Налагодження --- collapse --- --- -title: Фігури вирівняні не так, як я очікував(-ла) +title: Фігури вирівняні не так, як потрібно --- -Якщо ти хочеш, щоб фігури були вирівняні - придивись уважніше до своїх координатних точок. Експериментуй з цифрами, поки не отримаєш потрібний тобі варіант. +Якщо ти хочеш, щоб фігури були вирівняні, — придивись уважніше до точок координат. Спробуй різні числа, поки не отримаєш потрібне тобі розташування. --- /collapse --- --- collapse --- - --- -title: Я не бачу деякі фігури на моєму мотиві +title: Я бачу не всі фігури у своєму мотиві --- -Порядок, в якому ти малюєш деталі, дуже важливий. +Порядок, у якому ти малюєш деталі, дуже важливий. -Комп'ютерна графіка побудована з багатьох шарів. У твоєму мотиві кожна фігура - це шар. Об'єкти на вищих шарах знаходяться перед об'єктами на нижчих шарах. Уяви, що ти вирізаєш всі фігури з паперу. Залежно від того, як ти будеш розташовувати та накладати цей папір, кінцевий результат може виглядати зовсім по-різному. +Комп'ютерна графіка побудована з шарів. У твоєму мотиві кожна фігура — це шар. Об'єкти на вищих шарах знаходяться перед об'єктами на нижчих шарах. Уяви, що ти вирізаєш всі фігури з паперу. Залежно від того, як ти розташуєш паперові деталі одна зверху іншої, кінцевий результат може виглядати по-різному. --- /collapse --- --- collapse --- - --- -title: Кола/квадрати не рівні +title: Кола чи квадрати не рівні --- -Третій та четвертий номери у `ellipse` та `rect` - це ширина та висота. Якщо зробити їх однаковими - вийде коло або квадрат. +Третій та четвертий числа в `ellipse` та `rect` — це ширина й висота. Якщо зробити їх однаковими — вийде коло або квадрат. --- /collapse --- -Ти можеш виявити помилку, яка не вказана тут. Можливо, ти зможеш придумати, як її виправити? -Нам подобається дізнаватись про твої помилки та про те, як їх вдалося виправити. Якщо ти знайшов(-ла) іншу помилку у своєму проєкті, скористайся формою зворотного зв'язку внизу цієї сторінки. - ---- /task --- ---- save --- diff --git a/uk-UA/step_4.md b/uk-UA/step_4.md index b29663b5..5d61d89b 100644 --- a/uk-UA/step_4.md +++ b/uk-UA/step_4.md @@ -1,41 +1,27 @@ -## Розширюй та тестуй - Візерунок +## Зроби візерунок -Настав час зібрати повноцінний візерунок! +У тебе є **мотив**, — настав час зібрати повноцінний візерунок. -![Приклади готових проєктів, в яких мотив використовується багаторазово, утворюючи повноцінний візерунок.](images/second.gif) +![Приклади готових проєктів, у яких мотив використовується багаторазово, утворюючи повноцінний візерунок.](images/second.gif) -

Абстракція - це вирішення проблем шляхом зменшення непотрібних деталей. - -

--- task --- -Подивись на цей Малайзійський листковий торт (kek lapis Sarawak). Як змінюється його мотив, щоб утворився загальний візерунок? +Щоб зробити повторюваний візерунок, змінюй кількість, розташування та розмір створеного мотиву. Якщо тобі потрібна допомога, прочитай поради внизу сторінки. -![Мотив з проєкту Малайзійський листковий торт поруч з повним візерунком.](images/kek-motif.png) +--- /task --- -Подивись на ці шпалери в стилі арт-деко. Як змінюється його мотив, щоб утворився загальний візерунок? -![Мотив з проєкту шпалер в стилі арт-деко поруч з повним візерунком.](images/spirals-motif.png) +--- task --- -Подумай про візерунок, який ти створюєш. Як змінюється твій мотив, щоб скласти загальний візерунок. Використовуй ці питання, які допоможуть тобі зробити висновки: -- Мотив обертається повністю або тільки його частина? -- В який бік він обертається? І на скільки? -- Чи має малюнок шари, які накладаються один на одного? -- Скільки разів повторюється мотив? -- Як відбувається повторення (тобто скільки рядків/стовпчиків)? -- Чи змінюються кольори? -- Чи є якісь інші деталі, які не входять до мотиву (наприклад, глазур у Малайзійському листковому торті)? +**Протестуй:** запусти код і подивись, який вигляд має твій візерунок. --- /task --- ---- task --- -Тепер, коли ти знаєш більше про перетворення мотиву в цілий візерунок - запрограмуй свій мотив, використовуючи свої відповіді на питання, наведені вище. -**Порада:** Не забувай, що ти можеш 'Подивитись код' будь-якого з прикладів у вступі та 'скопіювати' і 'вставити' код у свій проєкт. Професійні девелопери роблять це постійно! -Ти здобув(-ла) дійсно дуже корисні навички. Ось нагадування, яке допоможе тобі створити повторення візерунка: +### Переміщення, обертання та зміна розміру [[[processing-matrix]]] @@ -45,20 +31,15 @@ [[[python-operators]]] -[[[generic-python-for-loop-repeat]]] - - --- collapse --- --- -title: Випадкові позиції +title: Змінюй розмір мотиву --- -Ти можеш додати `from random import randint` у верхній частині **main.py** - це дозволить використовувати функцію `randint` для генерування випадкових чисел. - -Для використання функції `randint` необхідно викликати її у своєму коді. +Якщо ти використовуєш вже намальований мотив, він може бути неправильного розміру. -Один із способів використання рандому - це переміщення мотиву у випадкову позицію кожного разу, коли він малюється: +Використовуй `scale()` перед викликом функції малювання мотиву, щоб змінити його розмір. Якщо число в дужках більше за «1», мотив стане більшим. Якщо воно менше за «1», він стане меншим. --- code --- --- @@ -66,79 +47,63 @@ language: python filename: main.py - draw() --- -push_matrix() #Запуск перенесення -translate(randint(0, 400), randint(0, 400)) -draw_motif() -pop_matrix() #Скинути перенесення + scale(0.5) # Наполовину менший --- /code --- -Ти також можеш використовувати випадковий порядок для зміни кольорів твого мотиву під час його малювання. - ---- code --- ---- -language: python -filename: main.py - draw() ---- +--- /collapse --- -BLUE = color(randint(0, 50), randint(0, 100), randint(150, 255)) +### Повторення ---- /code --- +[[[generic-python-for-loop-repeat]]] ---- /collapse --- +### Випадковість --- collapse --- - --- -title: Зміна розміру мотиву +title: Випадкове положення --- -Якщо ти використовуєш вже намальований мотив, він може бути неправильного розміру. +Ти можеш додати рядок `from random import randint` на початку **main.py** — це дасть змогу використовувати функцію `randint` для генерування випадкових чисел. -Ти можеш використовувати `scale()` перед викликом функції, яка малює мотив, щоб змінити його розмір. Введення значення більшого за '1' зробить мотив більшим, введення значення меншого за '1' зробить його меншим. +Для використання функції `randint` необхідно викликати її у своєму коді. + +Один зі способів використання випадкових чисел — це переміщувати мотиву у випадкове положення щоразу, як він малюється: --- code --- --- -language: python +language: python filename: main.py - draw() + --- -scale(0.5) #Половина розміруe + push_matrix() # Початок переміщення + translate(randint(0, 400), randint(0, 400)) + draw_motif() + pop_matrix() # Скинути переміщення --- /code --- ---- /collapse --- - ---- /task --- - -Тепер ти можеш додати до свого візерунка анімацію, щоб показати, як він був створений. Часто візерунки мають велике культурне значення в тому, яким чином вони зроблені, або в процесі їх виготовлення. - ---- task --- - -[[[processing-matrix]]] - -[[[processing-translation]]] - -[[[processing-rotation]]] - -[[[generic-python-for-loop-repeat]]] - ---- /task --- +Ти також можеш використовувати випадкові числа, щоб змінювати кольори свого мотиву щоразу, як він малюється. +--- code --- +--- +language: python +filename: main.py - draw() ---- task --- +--- -**Тест:** Покажи комусь свій проєкт та отримай зворотний зв'язок. Ти хочеш внести якісь зміни до свого візерунка? + BLUE = color(randint(0, 50), randint(0, 100), randint(150, 255)) ---- /task --- +--- /code --- ---- task --- +--- /collapse --- -**Налагодження:** Можливо, у твоєму проєкті знайдуться помилки, які потрібно буде виправити. Ось деякі поширені помилки. +### Налагодження --- collapse --- --- -title: Здається, мій мотив не обертається +title: Мій мотив не обертається --- Переконайся, що ти використовуєш функцію `radian()` для перетворення градусів у радіани. @@ -147,21 +112,12 @@ title: Здається, мій мотив не обертається --- collapse --- --- -title: Ротація виглядає дивно +title: Мотив дивно обертається --- Перевір, чи правильно ти використовуєш `translate()` для переходу до потрібних координат і навпаки? -У тебе обертається більше одного елемента? Тобі може знадобитися використати `push_matrix()` та `pop_matrix()`, щоб екран обертався одночасно в різних точках. - ---- /collapse --- - ---- collapse --- ---- -title: Мій візерунок не має анімації ---- - -Перевір правильність використання `frame_count()` у циклі. +У тебе обертається більше одного елемента? Спробуй використати `push_matrix()` та `pop_matrix()`, щоб екран обертався одночасно в різних точках. --- /collapse --- @@ -170,7 +126,7 @@ title: Мій візерунок не має анімації title: Мій візерунок виглядає не так, як я хочу --- -Переглянь наведені вище пункти про `rotate()` та `translate()`. Експериментуй, поки не отримаєш бажаного результату, і пам'ятай, що помилки - це сила! +Переглянь наведені вище пункти про `rotate()` та `translate()`. Експериментуй, поки не отримаєш бажаного результату, і пам'ятай, що помилки — це сила! --- /collapse --- @@ -183,20 +139,3 @@ title: У мене виникає помилка --- /collapse --- ---- collapse --- ---- -title: Анімація занадто швидка/повільна ---- - -Зміни `frame_rate()` на початку твоєї програми, щоб вона працювала з потрібною тобі швидкістю. - ---- /collapse --- - -Ти можеш виявити помилку, яка не вказана тут. Можливо, ти зможеш придумати, як її виправити? - -Нам подобається дізнаватись про твої помилки та про те, як їх вдалося виправити. Якщо ти знайшов(-ла) іншу помилку у своєму проєкті, скористайся формою зворотного зв'язку внизу цієї сторінки. - ---- /task --- - - ---- save --- diff --git a/uk-UA/step_5.md b/uk-UA/step_5.md index 95f0e61c..d34fbaed 100644 --- a/uk-UA/step_5.md +++ b/uk-UA/step_5.md @@ -1,99 +1,39 @@ -## Контрольний список +## Додаткове завдання -Вже ознайомилися з **коротким описом проєкту**? Проаналізуй свій проєкт, переглянь наведений нижче контрольний список та відміть ті пункти, які стосуються твого проєкту. +--- challenge --- -Які пункти стосуються твого потужного візерунка: +![Приклади завершених проєктів з елементами вхідних даних.](images/upgrade.gif) --- task --- -Малювання та розташування геометричних фігур для створення базового візерунка (або мотиву) ---- /task --- - ---- task --- - -Використання циклів для повторення візерунка, щоб заповнити весь екран - ---- /task --- - ---- task --- - -Анімація процесу створення візерунка - ---- /task --- - -Які з цих необов'язкових пунктів стосуються твого потужного візерунка: - ---- task --- - -Використання насичених або виразних кольорів - ---- /task --- - ---- task --- - -Натхненний твоєю або іншою популярною культурою - ---- /task --- - ---- task --- - -Отримання вхідних даних від користувача для зміни розміру візерунка +Використовуй текст та емоджі, щоб вивести на екран опис свого візерунка функцією `print()`. --- /task --- --- task --- -Додавання тексту та емодзі, щоб відобразити більше деталей про твоє мистецтво +Налаштуй розмір візерунка на основі вхідних даних від користувача. Використовуй для цього функцію `input()`. --- /task --- --- task --- -Перенесення візерунка для створення додаткових варіацій +Анімуй свій візерунок, щоб він з’являвся поступово. --- /task --- ---- task --- - -Поділитись з іншими своєю роботою в онлайн-галереї +--- no-print --- ---- /task --- +Цей проєкт використовує текст та емоджі, щоб запропонувати користувачам обрати розмір, а потім використовує їхню відповідь для визначення розміру всіх фігур: -Роздуми про те, як створювався твій потужний візерунок, допоможуть тобі у майбутніх проєктах. +[Тартан клану Макʼюенів](https://editor.raspberrypi.org/uk-UA/projects/mcewen-tartan-example){:target="_blank"} -Дай відповіді на наведені нижче запитання. Намалюй, напиши, надрукуй у документі, розкажи комусь або використовуй свій власний творчий спосіб, який найкраще тобі підходить, щоб дати свої відповіді. ---- task --- - -Звідки у тебе з'явилися ідеї? - ---- /task --- + ---- task --- - -Що нового цікавого ти дізнався(лась)? - ---- /task --- - ---- task --- - -Помилки та невдачі часто стають стимулом для розвитку та успіху. - -Опра Вінфрі була звільнена з першої роботи, але стала відомою та авторитетною продюсеркою та філантропом. Якось вона сказала: "Перетворіть свої рани на мудрість". - -Які помилки ти допустив(-ла) і як вони тобі допомогли? - ---- /task --- - -### Тепер ти - цифровий художник та математик! - -Знайди хвилинку, щоб насолодитися тим, що вдалося зробити. - ---- task --- - -Куди ти спрямуєш свої нові сили? Що будеш робити далі? - ---- /task --- +--- /no-print --- +--- /challenge --- diff --git a/uk-UA/step_6.md b/uk-UA/step_6.md index f0621496..f30fefc0 100644 --- a/uk-UA/step_6.md +++ b/uk-UA/step_6.md @@ -1,25 +1,16 @@ -## Вдосконалення твого проєкту -Якщо у тебе є час, ти можеш вдосконалити свій проєкт. Можливо, у тебе вже є ідеї, які ти можеш додати. Ти також можеш повернутися до першого етапу та переглянути інші проєкти, щоб отримати більше натхнення. +## Що ти тепер вмієш? -![Готові приклади з вхідними даними та оформленням з елементів обличчя](images/upgrade.gif) -Ти можеш: -- Використати текст та емодзі, щоб `print()` опис для твого візерунка -- Налаштувати розмір візерунка на основі вхідних даних від користувача `input()` -- Створити масштабний візерунок, використовуючи свій проєкт [Обличчя](https://projects.raspberrypi.org/uk-UA/projects/make-a-face){:target="_blank"} +Спробуй напрям [«Більше Python»](https://projects.raspberrypi.org/uk-UA/pathways/more-python), де розглядаються складніші проєкти, ніж у «Вступі до Python». Ти навчишся використовувати списки, словники й файли, щоб створювати діаграми, моделі та зображення. -Кожен з прикладів проєктів в [Знайомство з Python](.) мають посилання **Подивитись код**, щоб відкрити проєкт та подивитися на код, щоб отримати ідеї та побачити, як вони працюють. +[[[python-coolest-projects]]] -Цей проєкт використовує текст та емодзі, щоб запропонувати користувачу обрати розмір, а потім використовує його відповідь для визначення розміру всіх фігур: +Або чому б не спробувати інший проєкт у [Python](https://projects.raspberrypi.org/uk-UA/projects?software%5B%5D=python)? -**Тартан Макьюєна**: [Подивитись код](https://trinket.io/python/6dd98dd8e1){:target="_blank"} -
- -
+*** -Переглянь деякі проєкти 'Потужні візерунки' створені членами спільноти Raspberry Pi Foundation [Потужні візерунки - Бібліотека спільноти](https://wke.lt/w/s/yyNPQT){:target="_blank"}. +Цей проєкт переклали волонтери. ---- save --- +Завдяки волонтерам ми надаємо можливість людям у всьому світі навчатися рідною мовою. Ви також можете допомогти нам у цьому — більше інформації про волонтерську програму на [rpf.io/translate](https://rpf.io/translate). diff --git a/uk-UA/step_7.md b/uk-UA/step_7.md index 226243af..fbfe0dde 100644 --- a/uk-UA/step_7.md +++ b/uk-UA/step_7.md @@ -2,17 +2,9 @@ Якщо ти перебуваєш у клубі, чому б не поділитися своїм проєктом з друзями? -Ти також можеш показати своїй родині, як працює твій проєкт, надіславши їм посилання. - -Щоб отримати посилання, натисни на кнопку **Share** у правому верхньому куті сторінки твого редактора Trinket та вибери **Link**. - -![Кнопка меню "Поділитися" збільшена, з підсвічуванням "Посилання".](images/share-button.png) - -**Порада:** Ти можеш поділитися посиланням на свій проєкт, навіть якщо у тебе немає облікового запису в Trinket; однак без облікового запису посилання на твій проєкт буде змінюватися щоразу, коли ти його будеш оновлювати. Якщо ти вже поділився посиланням з кимось, тобі потрібно буде надіслати нове посилання, щоб вони побачили внесені зміни. - --- task --- -Надихай спільноту Raspberry Pi Foundation своїм проєктом! +Щоб отримати посилання, натисни на кнопку **Share** у правому верхньому куті сторінки твого редактора Trinket та вибери **Link**. Для того, щоб твій проєкт був доданий до студії [Потужні візерунки - Бібліотека спільноти'](https://wke.lt/w/s/yyNPQT){:target=blank}, будь ласка, заповни [цю форму](https://form.raspberrypi.org/f/community-project-submissions){:target="_blank"}.