diff --git a/ar-SA/meta.yml b/ar-SA/meta.yml new file mode 100644 index 0000000..8ce09d4 --- /dev/null +++ b/ar-SA/meta.yml @@ -0,0 +1,11 @@ +--- +title: مصفوفة الدفع و النوافذ المنبثقة +hero_image: images/banner.png +description: مصفوفة الدفع و النوافذ المنبثقة +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: مصفوفة الدفع و النوافذ المنبثقة diff --git a/ar-SA/python-comments.txt b/ar-SA/python-comments.txt new file mode 100644 index 0000000..ff4d693 --- /dev/null +++ b/ar-SA/python-comments.txt @@ -0,0 +1,23 @@ +اصنع عين + +العين الخارجية + +قزحية + +طالب + +Catchlight 1 مع عتامه + +Catchlight 2 مع عتامه + +حرك الشاشة الى المنتصف + +الراس + +حفظ اعدادات الشاشة الحالية + +حرك الشاشة إلى اليسار للعين اليسرى + +استعادة إعدادات الشاشة السابقة (ازالة ترجمة العين والدوران) + +حرك الشاشة إلى اليمين للعين اليمنى diff --git a/ar-SA/python-translatable.txt b/ar-SA/python-translatable.txt new file mode 100644 index 0000000..5dcbd84 --- /dev/null +++ b/ar-SA/python-translatable.txt @@ -0,0 +1,9 @@ +عين + +أبيض + +أزرق + +أسود + +ارسم diff --git a/ar-SA/step_1.md b/ar-SA/step_1.md new file mode 100644 index 0000000..a0d9483 --- /dev/null +++ b/ar-SA/step_1.md @@ -0,0 +1,40 @@ +عند استخدام `rotate ()` و `translate ()`، يمكنك حفظ إعدادات الإحداثيات باستخدام وظيفة `push_matrix ()` ثم استعادة إعدادات الإحداثي هذه باستخدام وظيفة `pop_matrix ()`. + +في هذا المثال، لإنشاء عينين دائرتين، يتم حفظ الإعدادات قبل رسم أي من العينين. تتم ترجمة الشاشة وتدويرها قبل رسم العين الأولى ثم استعادة الإعدادات قبل رسم العين الثانية. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/cy-GB/meta.yml b/cy-GB/meta.yml new file mode 100644 index 0000000..666118f --- /dev/null +++ b/cy-GB/meta.yml @@ -0,0 +1,11 @@ +--- +title: matrics gwthio a phopian +hero_image: images/banner.png +description: matrics gwthio a phopian +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Matrics gwthio a phopian diff --git a/cy-GB/python-comments.txt b/cy-GB/python-comments.txt new file mode 100644 index 0000000..f3b3e0d --- /dev/null +++ b/cy-GB/python-comments.txt @@ -0,0 +1,23 @@ +Creu llygad + +Tu allan y llygad + +Iris + +Cannwyll llygad + +Goleubwynt 1 gydag afloywder + +Goleubwynt 2 gydag afloywder + +Symud y sgrin i'r canol + +Pen + +Cadw'r gosodiadau sgrin presennol + +Symud y sgrin i'r chwith ar gyfer y llygad chwith + +Adfer y gosodiadau sgrin blaenorol (tynnu trosiad a chylchdroad y llygad) + +Symud y sgrin i'r dde ar gyfer y llygad dde diff --git a/cy-GB/python-translatable.txt b/cy-GB/python-translatable.txt new file mode 100644 index 0000000..0fe5ef3 --- /dev/null +++ b/cy-GB/python-translatable.txt @@ -0,0 +1,9 @@ +llygad + +GWYN + +GLAS + +DU + +draw diff --git a/cy-GB/step_1.md b/cy-GB/step_1.md new file mode 100644 index 0000000..e73bc5b --- /dev/null +++ b/cy-GB/step_1.md @@ -0,0 +1,40 @@ +Wrth ddefnyddio'r swyddogaethau `rotate()` a `translate()` fe allwch chi gadw'r gosodiadau cyfesurynnau drwy ddefnyddio'r swyddogaeth `push_matrix()`, ac yna adfer y gosodiadau hynny drwy ddefnyddio'r swyddogaeth `pop_matrix()`. + +Yn yr enghraifft hon, i greu dwy lygad sy'n cylchdroi, mae'r gosodiadau'n cael eu cadw cyn llunio unrhyw lygad. Mae'r sgrin yn cael ei throsi a'i chylchdroi cyn llunio'r llygad gyntaf, yna mae'r gosodiadau'n cael eu hadfer cyn llunio'r ail lygad. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/de-DE/meta.yml b/de-DE/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/de-DE/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/de-DE/python-comments.txt b/de-DE/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/de-DE/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/de-DE/python-translatable.txt b/de-DE/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/de-DE/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/de-DE/step_1.md b/de-DE/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/de-DE/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/el-GR/meta.yml b/el-GR/meta.yml new file mode 100644 index 0000000..9c3aba0 --- /dev/null +++ b/el-GR/meta.yml @@ -0,0 +1,11 @@ +--- +title: αποθήκευση και επαναφορά πίνακα +hero_image: images/banner.png +description: αποθήκευση και επαναφορά πίνακα +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Αποθήκευση και επαναφορά πίνακα diff --git a/el-GR/python-comments.txt b/el-GR/python-comments.txt new file mode 100644 index 0000000..7950b96 --- /dev/null +++ b/el-GR/python-comments.txt @@ -0,0 +1,23 @@ +Δημιούργησε ένα μάτι + +Εξωτερικό μάτι + +Ίριδα + +Κόρη + +Λαμπύρισμα 1 με αδιαφάνεια + +Λαμπύρισμα 2 με αδιαφάνεια + +Μετακίνησε την οθόνη στο κέντρο + +Κεφάλι + +Αποθηκεύει τις τρέχουσες ρυθμίσεις οθόνης + +Μετακίνησε την οθόνη προς τα αριστερά για το αριστερό μάτι + +Επαναφέρει τις προηγούμενες ρυθμίσεις οθόνης (καταργεί τη μεταφορά και την περιστροφή του ματιού) + +Μετακίνησε την οθόνη προς τα δεξιά για το δεξιό μάτι diff --git a/el-GR/python-translatable.txt b/el-GR/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/el-GR/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/el-GR/step_1.md b/el-GR/step_1.md new file mode 100644 index 0000000..ac09c54 --- /dev/null +++ b/el-GR/step_1.md @@ -0,0 +1,40 @@ +Όταν χρησιμοποιείς τις συναρτήσεις `rotate()` και `translate()`, μπορείς να αποθηκεύεις τις ρυθμίσεις των συντεταγμένων χρησιμοποιώντας τη συνάρτηση `push_matrix()` και στη συνέχεια να επαναφέρεις αυτές τις ρυθμίσεις των συντεταγμένων χρησιμοποιώντας τη συνάρτηση `pop_matrix()`. + +Σε αυτό το παράδειγμα, για να δημιουργήσεις δύο περιστρεφόμενα μάτια, οι ρυθμίσεις αποθηκεύονται προτού σχεδιαστεί κάποιο από τα μάτια. Η οθόνη μετακινείται και περιστρέφεται πριν σχεδιαστεί το πρώτο μάτι και στη συνέχεια επαναφέρουμε τις ρυθμίσεις πριν σχεδιαστεί το δεύτερο μάτι. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/en-US/meta.yml b/en-US/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/en-US/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/en-US/python-comments.txt b/en-US/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/en-US/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/en-US/python-translatable.txt b/en-US/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/en-US/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/en-US/step_1.md b/en-US/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/en-US/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/es-LA/meta.yml b/es-LA/meta.yml new file mode 100644 index 0000000..903adbe --- /dev/null +++ b/es-LA/meta.yml @@ -0,0 +1,11 @@ +--- +title: matrix push y pop +hero_image: images/banner.png +description: matrix push y pop +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Matrix push y pop diff --git a/es-LA/python-comments.txt b/es-LA/python-comments.txt new file mode 100644 index 0000000..402a8e2 --- /dev/null +++ b/es-LA/python-comments.txt @@ -0,0 +1,23 @@ +Crea un ojo + +Exterior del ojo + +Iris + +Pupila + +Brillo ocular 1 con opacidad + +Brillo ocular 2 con opacidad + +Mueve la pantalla al centro + +Cabeza + +Guarda la configuración de pantalla actual + +Mueve la pantalla a la izquierda para el ojo izquierdo + +Restaura la configuración de pantalla anterior (elimina el traslado y rotación de los ojos) + +Mueve la pantalla a la derecha para el ojo derecho diff --git a/es-LA/python-translatable.txt b/es-LA/python-translatable.txt new file mode 100644 index 0000000..98b0032 --- /dev/null +++ b/es-LA/python-translatable.txt @@ -0,0 +1,9 @@ +ojo + +BLANCO + +AZUL + +NEGRO + +dibujar diff --git a/es-LA/step_1.md b/es-LA/step_1.md new file mode 100644 index 0000000..60d40c8 --- /dev/null +++ b/es-LA/step_1.md @@ -0,0 +1,40 @@ +Al utilizar las funciones `rotar()` y `trasladar()`, puedes guardar la configuración de coordenadas utilizando la función `push_matrix()` y luego restaurar esa configuración de coordenadas utilizando la función `pop_matrix()`. + +En este ejemplo, para crear dos ojos giratorios, la configuración se guarda antes de dibujar cualquiera de los ojos. La pantalla se traslada y gira antes de que se dibuje el primer ojo y luego se restablece la configuración antes de que se dibuje el segundo ojo. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/fr-FR/meta.yml b/fr-FR/meta.yml new file mode 100644 index 0000000..7a947a8 --- /dev/null +++ b/fr-FR/meta.yml @@ -0,0 +1,11 @@ +--- +title: push et pop matrix +hero_image: images/banner.png +description: push et pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push et pop matrix diff --git a/fr-FR/python-comments.txt b/fr-FR/python-comments.txt new file mode 100644 index 0000000..7db7909 --- /dev/null +++ b/fr-FR/python-comments.txt @@ -0,0 +1,23 @@ +Créer un œil + +Oeil extérieur + +Iris + +Pupille + +Reflet spéculaire 1 avec opacité + +Reflet spéculaire 2 avec opacité + +Déplacer l'écran vers le milieu + +Tête + +Enregistre les paramètres d'écran actuels + +Déplacer l'écran vers la gauche pour l'œil gauche + +Restaure les paramètres d'écran précédents (supprime la translation et la rotation des yeux) + +Déplacer l'écran vers la droite pour l'œil droit diff --git a/fr-FR/python-translatable.txt b/fr-FR/python-translatable.txt new file mode 100644 index 0000000..85e0377 --- /dev/null +++ b/fr-FR/python-translatable.txt @@ -0,0 +1,9 @@ +œil + +BLANC + +BLEU + +NOIR + +dessiner diff --git a/fr-FR/step_1.md b/fr-FR/step_1.md new file mode 100644 index 0000000..b4a27d1 --- /dev/null +++ b/fr-FR/step_1.md @@ -0,0 +1,40 @@ +Lorsque tu utilises les fonctions `rotate()` et `translate()` , tu peux enregistrer les paramètres de coordonnées à l'aide de la fonction `push_matrix()` , puis restaurer ces paramètres de coordonnées à l'aide de la fonction `pop_matrix()`. + +Dans cet exemple, pour créer deux yeux rotatifs, les paramètres sont enregistrés avant que l'un ou l'autre des yeux ne soit dessiné. L'écran est translaté et pivoté avant que le premier œil ne soit dessiné puis les paramètres restaurés avant que le deuxième œil ne soit dessiné. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/hi-IN/meta.yml b/hi-IN/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/hi-IN/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/hi-IN/python-comments.txt b/hi-IN/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/hi-IN/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/hi-IN/python-translatable.txt b/hi-IN/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/hi-IN/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/hi-IN/step_1.md b/hi-IN/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/hi-IN/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/it-IT/meta.yml b/it-IT/meta.yml new file mode 100644 index 0000000..3d86adc --- /dev/null +++ b/it-IT/meta.yml @@ -0,0 +1,11 @@ +--- +title: push e pop matrix +hero_image: images/banner.png +description: push e pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push e pop matrix diff --git a/it-IT/python-comments.txt b/it-IT/python-comments.txt new file mode 100644 index 0000000..e062bda --- /dev/null +++ b/it-IT/python-comments.txt @@ -0,0 +1,23 @@ +Disegna un occhio + +Parte esterna dell'occhio + +Iride + +Pupilla + +Riflesso 1 con opacità + +Riflesso 2 con opacità + +Sposta lo schermo al centro + +Testa + +Salva le impostazioni attuali dello schermo + +Sposta lo schermo a sinistra per l'occhio sinistro + +Ripristina le impostazioni dello schermo precedenti (rimuovi la traslazione e la rotazione dell'occhio) + +Sposta lo schermo a destra per l'occhio destro diff --git a/it-IT/python-translatable.txt b/it-IT/python-translatable.txt new file mode 100644 index 0000000..a62b6b0 --- /dev/null +++ b/it-IT/python-translatable.txt @@ -0,0 +1,9 @@ +occhio + +BIANCO + +BLU + +NERO + +draw diff --git a/it-IT/step_1.md b/it-IT/step_1.md new file mode 100644 index 0000000..a3c1649 --- /dev/null +++ b/it-IT/step_1.md @@ -0,0 +1,40 @@ +Quando usi le funzioni `rotate()` e `translate()` puoi salvare le impostazioni delle coordinate usando la funzione `push_matrix()` e, in seguito, ripristinarle usando la funzione `pop_matrix()`. + +In questo esempio, per creare due occhi che si muovono, le impostazioni vengono salvate prima che venga disegnato uno dei due occhi. Lo schermo viene spostato e rotato prima che il primo occhio venga disegnato, poi le impostazioni vengono ripristinate prima che il secondo occhio venga disegnato. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/ja-JP/meta.yml b/ja-JP/meta.yml new file mode 100644 index 0000000..f8f497f --- /dev/null +++ b/ja-JP/meta.yml @@ -0,0 +1,11 @@ +--- +title: マトリックスの保存と復元 +hero_image: images/banner.png +description: マトリックスの保存と復元 +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: マトリックスの保存と復元 diff --git a/ja-JP/python-comments.txt b/ja-JP/python-comments.txt new file mode 100644 index 0000000..a332f5f --- /dev/null +++ b/ja-JP/python-comments.txt @@ -0,0 +1,23 @@ +目を作成する + +目の形 + +虹彩 + +瞳 + +不透明度設定を使った光の当たり方の表現1 + +不透明度設定を使った光の当たり方の表現2 + +画面を中央に移動する + +頭 + +現在の画面設定を保存する + +左目を描くため画面を左に移動する + +元の画面設定を復元する(目の描画のための平行移動と回転を取り消す) + +右目を描くため画面を右に移動する diff --git a/ja-JP/python-translatable.txt b/ja-JP/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/ja-JP/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/ja-JP/step_1.md b/ja-JP/step_1.md new file mode 100644 index 0000000..d4f7617 --- /dev/null +++ b/ja-JP/step_1.md @@ -0,0 +1,40 @@ +`rotate()`および`translate()`関数を使用するときに、`push_matrix()`関数を使用して座標設定を保存し、`pop_matrix()`関数を使用して保存した座標設定を復元できます。 + +この例では、回転する2つの目を作成するために、片方の目を描画する前に設定を保存しています。 最初の目を描画する前に画面を平行移動および回転し、2番目の目を描画する前に設定を復元しています。 + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/kn-IN/meta.yml b/kn-IN/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/kn-IN/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/kn-IN/python-comments.txt b/kn-IN/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/kn-IN/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/kn-IN/python-translatable.txt b/kn-IN/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/kn-IN/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/kn-IN/step_1.md b/kn-IN/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/kn-IN/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/mr-IN/meta.yml b/mr-IN/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/mr-IN/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/mr-IN/python-comments.txt b/mr-IN/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/mr-IN/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/mr-IN/python-translatable.txt b/mr-IN/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/mr-IN/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/mr-IN/step_1.md b/mr-IN/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/mr-IN/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/nl-NL/meta.yml b/nl-NL/meta.yml new file mode 100644 index 0000000..29edef7 --- /dev/null +++ b/nl-NL/meta.yml @@ -0,0 +1,11 @@ +--- +title: push en pop matrix +hero_image: images/banner.png +description: push en pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push en pop matrix diff --git a/nl-NL/python-comments.txt b/nl-NL/python-comments.txt new file mode 100644 index 0000000..719175e --- /dev/null +++ b/nl-NL/python-comments.txt @@ -0,0 +1,23 @@ +Maak een oog + +Buitenkant oog + +Iris + +Pupil + +Lichtinval 1 met doorzichtigheid + +Lichtinval 2 met doorzichtigheid + +Scherm naar het midden verplaatsen + +Hoofd + +Slaat huidige scherminstellingen op + +Verplaats het scherm naar links voor het linkeroog + +Herstel vorige scherminstellingen (verwijdert de locatie en draaiing van het oog) + +Verplaats het scherm naar rechts voor het rechteroog diff --git a/nl-NL/python-translatable.txt b/nl-NL/python-translatable.txt new file mode 100644 index 0000000..c766eaa --- /dev/null +++ b/nl-NL/python-translatable.txt @@ -0,0 +1,9 @@ +oog + +WIT + +BLAUW + +ZWART + +draw diff --git a/nl-NL/step_1.md b/nl-NL/step_1.md new file mode 100644 index 0000000..47247d0 --- /dev/null +++ b/nl-NL/step_1.md @@ -0,0 +1,40 @@ +Als je de functies `rotate()` en `translate()` gebruikt, kunt je de coördinaatinstellingen opslaan met de functie `push_matrix()` en vervolgens die coördinaatinstellingen herstellen met de functie `pop_matrix()`. + +Om in dit voorbeeld twee roterende ogen te maken, worden de instellingen opgeslagen voordat een van de ogen wordt getekend. Het scherm wordt verschoven (translate) en gedraaid (rotate) voordat het eerste oog wordt getekend, waarna de instellingen worden hersteld voordat het tweede oog wordt getekend. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/pl-PL/meta.yml b/pl-PL/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/pl-PL/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/pl-PL/python-comments.txt b/pl-PL/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/pl-PL/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/pl-PL/python-translatable.txt b/pl-PL/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/pl-PL/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/pl-PL/step_1.md b/pl-PL/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/pl-PL/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/pt-BR/meta.yml b/pt-BR/meta.yml new file mode 100644 index 0000000..a49b1aa --- /dev/null +++ b/pt-BR/meta.yml @@ -0,0 +1,11 @@ +--- +title: matriz "push" e "pop" +hero_image: images/banner.png +description: matriz "push" e "pop" +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Matriz "push" e "pop" diff --git a/pt-BR/python-comments.txt b/pt-BR/python-comments.txt new file mode 100644 index 0000000..5aeca11 --- /dev/null +++ b/pt-BR/python-comments.txt @@ -0,0 +1,23 @@ +Cria um olho + +Circulo externo do olho + +Íris + +Pupila + +Brilhos nos olhos 1 com opacidade + +Brilho nos olhos 2 com opacidade + +Move a tela para o meio + +Cabeça + +Salva as definições atuais da tela + +Move a tela para a esquerda, para desenhar o olho esquerdo + +Restaura as definições anteriores da tela (remove a translação e a rotação dos olhos) + +Move a tela para a direita, para desenhar o olho direito diff --git a/pt-BR/python-translatable.txt b/pt-BR/python-translatable.txt new file mode 100644 index 0000000..401425f --- /dev/null +++ b/pt-BR/python-translatable.txt @@ -0,0 +1,9 @@ +olho + +BRANCO + +AZUL + +PRETO + +desenhar diff --git a/pt-BR/step_1.md b/pt-BR/step_1.md new file mode 100644 index 0000000..4a882d0 --- /dev/null +++ b/pt-BR/step_1.md @@ -0,0 +1,40 @@ +Ao usar as funções `rotate()` e `translate()`, você pode salvar as coordenadas definidas usando a função `push_matrix()` e recuperá-las usando a função `pop_matrix()`. + +Neste exemplo, para criar dois olhos rotativos, as definições são salvas antes que qualquer um dos olhos seja desenhado. A tela é transladada e rotacionada antes que o primeiro olho seja desenhado e as definições são restauradas antes que o segundo olho seja desenhado. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/ru-RU/meta.yml b/ru-RU/meta.yml new file mode 100644 index 0000000..5cc3d77 --- /dev/null +++ b/ru-RU/meta.yml @@ -0,0 +1,11 @@ +--- +title: push and pop matrix +hero_image: images/banner.png +description: push and pop matrix +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Push and pop matrix diff --git a/ru-RU/python-comments.txt b/ru-RU/python-comments.txt new file mode 100644 index 0000000..463c3c4 --- /dev/null +++ b/ru-RU/python-comments.txt @@ -0,0 +1,23 @@ +Create an eye + +Outer eye + +Iris + +Pupil + +Catchlight 1 with opacity + +Catchlight 2 with opacity + +Move screen to the middle + +Head + +Saves current screen settings + +Move screen to the left for left eye + +Restores previous screen settings (removes the eye translation and rotation) + +Move screen to the right for right eye diff --git a/ru-RU/python-translatable.txt b/ru-RU/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/ru-RU/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/ru-RU/step_1.md b/ru-RU/step_1.md new file mode 100644 index 0000000..10ce0b6 --- /dev/null +++ b/ru-RU/step_1.md @@ -0,0 +1,40 @@ +When using `rotate()` and `translate()` functions you can save the coordinate settings by using the `push_matrix()` function then restore those coordinate settings using the `pop_matrix()` function. + +In this example, to create two rotating eyes, the settings are saved before either of the eyes are drawn. The screen is translated and rotated before the first eye is drawn then the settings restored before the second eye is drawn. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- + diff --git a/uk-UA/meta.yml b/uk-UA/meta.yml new file mode 100644 index 0000000..a7a1953 --- /dev/null +++ b/uk-UA/meta.yml @@ -0,0 +1,11 @@ +--- +title: матриця push та pop +hero_image: images/banner.png +description: матриця push та pop +version: 4 +listed: false +copyedit: false +last_tested: "2021-09-28" +steps: + - + title: Матриця push та pop diff --git a/uk-UA/python-comments.txt b/uk-UA/python-comments.txt new file mode 100644 index 0000000..8ad01df --- /dev/null +++ b/uk-UA/python-comments.txt @@ -0,0 +1,23 @@ +Створення ока + +Зовнішня частина ока + +Райдужна оболонка + +Зіниця + +Світлові відблиски 1 з прозорістю + +Світлові відблиски 2 з прозорістю + +Переміщення екрана в центр + +Голова + +Зберігає поточні налаштування екрана + +Переміщення екрана вліво для лівого ока + +Відновлення попередніх налаштувань екрана (видалення перекладу та обертання очей) + +Переміщення екрана вправо для правого ока diff --git a/uk-UA/python-translatable.txt b/uk-UA/python-translatable.txt new file mode 100644 index 0000000..33339ff --- /dev/null +++ b/uk-UA/python-translatable.txt @@ -0,0 +1,9 @@ +eye + +WHITE + +BLUE + +BLACK + +draw diff --git a/uk-UA/step_1.md b/uk-UA/step_1.md new file mode 100644 index 0000000..1c3a6da --- /dev/null +++ b/uk-UA/step_1.md @@ -0,0 +1,40 @@ +Використовуючи функції `rotate()` та `translate()`, ти можеш зберегти налаштування координат, скориставшись функцією `push_matrix()`, а потім використати ці налаштування координат за допомогою функції `pop_matrix()`. + +У цьому прикладі, для створення двох очей, які обертаються, налаштування зберігаються до того, як будь-яке з очей буде намальовано. Екран перекладається та обертається до того, як буде намальоване перше око, потім налаштування відновлюються до того, як буде намальоване друге око. + +--- code --- +--- +language: python + +--- + +def eye(): # Create an eye fill(WHITE) ellipse(0, 0, 150, 150) # Outer eye no_stroke() fill(BLUE) ellipse(0, 0, 80, 80) # Iris fill(BLACK) ellipse(0, 0, 35, 35) # Pupil fill(WHITE, 70) ellipse(-25, -20, 30, 30) # Catchlight 1 with opacity ellipse(25, 25, 10, 10) # Catchlight 2 with opacity + +def draw(): global BLUE, BLACK, WHITE + + BLUE = color(1, 32, 100) + BLACK = color(0, 0, 0) + WHITE = color(255, 255, 255) + + background(WHITE) + translate(width/2, height/2) # Move screen to the middle + + stroke(BLACK) + ellipse(0, 0, 300, 300) # Head + + push_matrix() # Saves current screen settings + + translate(-100, 0) # Move screen to the left for left eye + for i in range(frame_count): + eye() + rotate(radians(45)) + + pop_matrix() # Restores previous screen settings (removes the eye translation and rotation) + + translate(100, 0) # Move screen to the right for right eye + for i in range(frame_count): + eye() + rotate(radians(45)) + +--- /code --- +