L’évènement organisé le week-end dernier, du 12 au 14 mai 2023, restera gravé dans les mémoires. Les résultats et les réalisations sont quant à eux gravés sur hackathon-ndlr.fr .
Vingt-deux élèves de seconde, première et terminale ont participé à ce marathon de programmation, s’affrontant en équipes pour réaliser un défi informatique sans connexion Internet et sans téléphone portable. Durant 42 heures, du vendredi soir au dimanche midi, des élèves passionnés ont fait preuve d’ une remarquable détermination, dépassant les moments de doute et même de découragement pour, au final, tous réussir leur création sans concession ou sacrifice sur le résultat.
Les deux enseignants de la spécialité NSI (Numérique et Science Informatique) ainsi qu’une vingtaine de parents volontaires les ont accompagnés tout au long de l’évènement.
Les équipes ont rivalisé d’ingéniosité et de créativité pour proposer des approches innovantes et surprenantes. Mais cet évènement a été bien plus qu’un défi technique . Il a vu des jeunes coopérer, se répartir habillement les tâches et s’organiser efficacement dans le temps, au sein des équipes, pour réussir leur objectif. Mais, à la grande surprise des adultes encadrants, les jeunes concurrents se sont progressivement mis au service des autres équipes pour partager leurs trouvailles et apporter leurs compétences.
Ainsi, en plus de la créativité et de l’audace, de la persévérance et de l’originalité, de l’intuition et de l’organisation, toutes les équipes ont surtout remarquablement fait preuve d’enthousiasme et d’entraide entre elles .
Ce week-end immersif a permis aux élèves de se surpasser, de se découvrir et de s’entraider, de dépasser leur inquiétude voire leur découragement, mais il a également permis aux adultes de vivre des moments forts avec les jeunes qu’ils accompagnaient.
Le défi de chaque équipe consistait à créer une animation graphique en deux dimensions (2D) mettant en avant le “chemin” parcouru par un élève au lycée NDLR (par exemple : son ressenti, son vécu, ses expériences…), sans utiliser de logiciel moderne d’animation ou de création graphique, mais seulement à l’aide de deux boites à outils logicielles de calcul (Numpy) et de graphisme mathématique (Matplotlib) associées au langage de programmation Python.
De plus, la première et la dernière image de l’animation devaient contenir le carré et les trois triangles du logo NDLR . Le passage d’une image à une autre se faisant progressivement à l’aide de techniques de morphing , mais sans utiliser d’application vidéo, mais seulement du code informatique soit à peu près l’équivalent des outils qui ont permis la création du générique de l’émission Thalassa il y a 40 ans . On trouvera d’ailleurs certaines ressemblances avec les créations du Hackathon.
Par ailleurs, privés de leur téléphone portable, d’Internet et des moteurs d’intelligence artificielle à la mode, les participants ont été contraints à la lecture approfondie des documentations techniques, souvent en Anglais, déposés sur leurs ordinateurs. Une compétence indispensable dans le monde du développement informatique aujourd’hui.
### Programme principal
#ndlr triangles
from
matplotlib.animation
import
ArtistAnimation
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.animation
as
animation
import
outils
nbEtapes =
100
"""---------------------------------------triangle----------------------------------------"""
#triangle 1
T1XDepartS1=[
-0.8
,
0
,
9
,
-0.8
]
T1YDepartS1=[
11.8
,
8.9
,
17.4
,
11.8
]
T1XArriveeS1=[
-2
,
0.4
,
2.5
,
-2
]
T1YArriveeS1=[
11.8
,
8
,
11.8
,
11.8
]
#triangle 2
T2XDepartS1=[
0.4
,
10.1
,
2
,
0.4
]
T2YDepartS1=[
5.9
,
14.1
,
11.7
,
5.9
]
T2XArriveeS1=[
5.6
,
7.9
,
3.2
,
5.6
]
T2YArriveeS1=[
7.9
,
11.7
,
11.7
,
7.9
]
#triangle 3
T3XDepartS1=[
0.6
,
11.6
,
2.9
,
0.6
]
T3YDepartS1=[
4.1
,
10.3
,
9.2
,
4.1
]
T3XArriveeS1=[
12.6
,
14.8
,
10.2
,
12.6
]
T3YArriveeS1=[
7.9
,
11.7
,
11.7
,
7.9
]
"---------------------------------------------------"
T1XDepartS3=[
-2
,
0.4
,
2.5
,
-2
]
T1YDepartS3=[
11.8
,
8
,
11.8
,
11.8
]
T1XArriveeS3=[
-2
,
0.4
,
2.5
,
-2
]
T1YArriveeS3=[
11.8
,
8
,
11.8
,
11.8
]
#triangle 2 / point interrogation orange
T2XDepartS3=[
5.6
,
7.9
,
3.2
,
3.2
,
5.6
,
5.6
]
T2YDepartS3=[
7.9
,
11.7
,
11.7
,
11.7
,
7.9
,
7.9
]
T2XArriveeS3=[
1.3
,
1.9
,
2.3
,
2.1
,
1.8
,
1.8
]
T2YArriveeS3=[
15.9
,
16.4
,
15.9
,
15.5
,
15.1
,
14.5
]
#triangle 3 / table / point d'interrogtion(+deux cotes)
T3XDepartS3=[
-1.8
,
0.4
,
2
,
3
,
4
,
8
]
T3YDepartS3=[
10
,
10
,
10
,
10
,
10
,
10
]
T3XArriveeS3=[
0.2
,
0.8
,
1.2
,
1
,
0.7
,
0.7
]
T3YArriveeS3=[
15.7
,
16.2
,
15.7
,
15.3
,
14.9
,
14.3
]
"""--------------------------------------------------"""
T1XDepartS4=[
-2
,
0.4
,
2.5
,
-2
]
T1YDepartS4=[
11.8
,
8
,
11.8
,
11.8
]
T1XArriveeS4=[
-2
,
0.4
,
2.5
,
-2
]
T1YArriveeS4=[
11.8
,
8
,
11.8
,
11.8
]
#triangle 2 / point interrogation orange => personne
T2XDepartS4=[
1.3
,
1.9
,
2.3
,
2.1
,
1.8
,
1.8
]
T2YDepartS4=[
15.9
,
16.4
,
15.9
,
15.5
,
15.1
,
14.5
]
T2XArriveeS4=[
9.1
,
11.4
,
11.4
,
6.8
,
6.8
,
9.1
]
T2YArriveeS4=[
7.9
,
11.7
,
11.7
,
11.7
,
11.7
,
7.9
]
#triangle 3 / table / point d'interrogtion(+deux cotes) => personne 2
T3XDepartS4=[
0.2
,
0.8
,
1.2
,
1
,
0.7
,
0.7
]
T3YDepartS4=[
15.7
,
16.2
,
15.7
,
15.3
,
14.9
,
14.3
]
T3XArriveeS4=[
14.1
,
14.1
,
16.3
,
16.3
,
11.7
,
14.1
]
T3YArriveeS4=[
7.9
,
7.9
,
11.7
,
11.7
,
11.7
,
7.9
]
"""------------------------------------------"""
T1XDepartS5=[
-2
,
0.4
,
2.5
,
-2
]
T1YDepartS5=[
11.8
,
8
,
11.8
,
11.8
]
T1XArriveeS5=[
-2
,
0.4
,
2.5
,
-2
]
T1YArriveeS5=[
11.8
,
8
,
11.8
,
11.8
]
#triangle 2 / point interrogation orange => personne
T2XDepartS5=[
9.1
,
11.4
,
11.4
,
6.8
,
6.8
,
9.1
]
T2YDepartS5=[
7.9
,
11.7
,
11.7
,
11.7
,
11.7
,
7.9
]
T2XArriveeS5=[
6.1
,
8.4
,
8.4
,
3.8
,
3.8
,
6.1
]
T2YArriveeS5=[
7.9
,
11.7
,
11.7
,
11.7
,
11.7
,
7.9
]
#triangle 3 / table / point d'interrogtion(+deux cotes) => personne 2
T3XDepartS5=[
14.1
,
14.1
,
16.3
,
16.3
,
11.7
,
14.1
]
T3YDepartS5=[
7.9
,
7.9
,
11.7
,
11.7
,
11.7
,
7.9
]
T3XArriveeS5=[
11.1
,
11.1
,
13.3
,
13.3
,
8.7
,
11.1
]
T3YArriveeS5=[
7.9
,
7.9
,
11.7
,
11.7
,
11.7
,
7.9
]
"""---------------------------------------------------------"""
T1XDepartS6=[
-2
,
0.4
,
2.5
,
-2
]
T1YDepartS6=[
11.8
,
8
,
11.8
,
11.8
]
T1XArriveeS6=[
1
,
3.4
,
5.5
,
1
]
T1YArriveeS6=[
11.8
,
8
,
11.8
,
11.8
]
#triangle 2 / point interrogation orange => personne => banderole
T2XDepartS6=[
9.1
,
11.4
,
11.4
,
6.8
,
6.8
,
9.1
]
T2YDepartS6=[
7.9
,
11.7
,
11.7
,
11.7
,
7.9
,
7.9
]
T2XArriveeS6=[
-1.8
,
-0.4
,
1
,
2.4
,
6.6
,
8
]
T2YArriveeS6=[
17
,
16
,
16
,
16
,
16
,
17
]
#triangle 3 / table / point d'interrogtion(+deux cotes) => personne 2 => banderole
T3XDepartS6=[
11.1
,
11.1
,
13.3
,
13.3
,
8.7
,
8.7
,
11.1
]
T3YDepartS6=[
7.9
,
7.9
,
11.7
,
11.7
,
11.7
,
11.7
,
7.9
]
T3XArriveeS6=[
0
,
1
,
2
,
3
,
4
,
5
,
6
]
T3YArriveeS6=[
16
,
14
,
16
,
14
,
16
,
14
,
16
]
"""---------------------------------------------------------"""
# Scène 7 : retour logo NDLR
# perso => triangle rouge
T1XDepartS7=[
1
,
3.4
,
5.5
,
1
]
T1YDepartS7=[
11.8
,
8
,
11.8
,
11.8
]
T1XArriveeS7=[
-0.8
,
0
,
9
,
-0.8
]
T1YArriveeS7=[
11.8
,
8.9
,
17.4
,
11.8
]
# banderole (ligne) => triangle orange
T2XDepartS7=[
-1.8
,
-0.4
,
1
,
2.4
,
6.6
,
8
]
T2YDepartS7=[
17
,
16
,
16
,
16
,
16
,
17
]
T2XArriveeS7=[
0.4
,
0.4
,
0.4
,
10.1
,
2
,
0.4
]
T2YArriveeS7=[
5.9
,
5.9
,
5.9
,
14.1
,
11.7
,
5.9
]
# banderole (drapeaux) => triangle jaune
T3XDepartS7=[
0
,
1
,
2
,
3
,
4
,
5
,
6
]
T3YDepartS7=[
16
,
14
,
16
,
14
,
16
,
14
,
16
]
T3XArriveeS7=[
0.6
,
0.6
,
0.6
,
0.6
,
11.6
,
2.9
,
0.6
]
T3YArriveeS7=[
4.1
,
4.1
,
4.1
,
4.1
,
10.3
,
9.2
,
4.1
]
"""-------------------------------Table---------------------------------------"""
#triangle 3 / table
TableXArrivee=[
-1.8
,
0
,
0.4
,
8
]
TableYArrivee=[
10
,
10
,
10
,
10
]
TableXDepart=[
12.6
,
14.8
,
10.2
,
12.6
]
TableYDepart=[
7.9
,
11.7
,
11.7
,
7.9
]
R1XDepartS1=[
0
,
13.6
,
13.6
,
0
,
0
]
R1YDepartS1=[
0
,
0
,
13.6
,
13.6
,
0
]
R1XArriveeS1 = [
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YArriveeS1 = [
13
,
15.5
,
15.5
,
13
,
13
]
# Rect 2
R2XDepartS1=[
0
,
13.6
,
13.6
,
0
,
0
]
R2YDepartS1=[
0
,
0
,
13.6
,
13.6
,
0
]
R2XArriveeS1 = [
4.5
,
4.5
,
7
,
7
,
4.5
]
R2YArriveeS1 = [
13
,
15.5
,
15.5
,
13
,
13
]
# Rect 3
R3XDepartS1=[
0
,
13.6
,
13.6
,
0
,
0
]
R3YDepartS1=[
0
,
0
,
13.6
,
13.6
,
0
]
R3XArriveeS1 = [
11
,
11
,
13.5
,
13.5
,
11
]
R3YArriveeS1 = [
13
,
15.5
,
15.5
,
13
,
13
]
"-----------------------"
# Scène 3
# Rect 1
R1XDepartS3=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YDepartS3=[
13
,
15.5
,
15.5
,
13
,
13
]
R1XArriveeS3=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YArriveeS3=[
13
,
15.5
,
15.5
,
13
,
13
]
# Rect 2
R2XDepartS3=[
4.5
,
4.5
,
7
,
7
,
4.5
]
R2YDepartS3=[
13
,
15.5
,
15.5
,
13
,
13
]
R2XArriveeS3=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R2YArriveeS3=[
13
,
15.5
,
15.5
,
13
,
13
]
# Rect 3
R3XDepartS3=[
4.5
,
4.5
,
7
,
7
,
4.5
]
R3YDepartS3=[
13
,
15.5
,
15.5
,
13
,
13
]
R3XArriveeS3=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R3YArriveeS3=[
13
,
15.5
,
15.5
,
13
,
13
]
"-----------------------"
#Scène 4
# Rect 1
R1XDepartS4=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YDepartS4=[
13
,
15.5
,
15.5
,
13
,
13
]
R1XArriveeS4=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YArriveeS4=[
12.8
,
15.3
,
15.3
,
12.8
,
12.8
]
# Rect 2
R2XDepartS4=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R2YDepartS4=[
13
,
15.5
,
15.5
,
13
,
13
]
R2XArriveeS4=[
8.1
,
8.1
,
10.4
,
10.4
,
8.1
]
R2YArriveeS4=[
12.8
,
15
,
15
,
12.8
,
12.8
]
# Rect 3
R3XDepartS4=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R3YDepartS4=[
13
,
15.5
,
15.5
,
13
,
13
]
R3XArriveeS4=[
12.9
,
12.9
,
15.2
,
15.2
,
12.9
]
R3YArriveeS4=[
12.8
,
15
,
15
,
12.8
,
12.8
]
"-----------------------"
# Scène 5
# Rect 1
R1XDepartS5=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YDepartS5=[
12.8
,
15.3
,
15.3
,
12.8
,
12.8
]
R1XArriveeS5=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YArriveeS5=[
12.8
,
15.3
,
15.3
,
12.8
,
12.8
]
# Rect 2
R2XDepartS5=[
8.1
,
8.1
,
10.4
,
10.4
,
8.1
]
R2YDepartS5=[
12.8
,
15
,
15
,
12.8
,
12.8
]
R2XArriveeS5=[
5.1
,
5.1
,
7.4
,
7.4
,
5.1
]
R2YArriveeS5=[
12.8
,
15
,
15
,
12.8
,
12.8
]
# Rect 3
R3XDepartS5=[
12.9
,
12.9
,
15.2
,
15.2
,
12.9
]
R3YDepartS5=[
12.8
,
15
,
15
,
12.8
,
12.8
]
R3XArriveeS5=[
10
,
10
,
12
,
12
,
10
]
R3YArriveeS5=[
12.8
,
15
,
15
,
12.8
,
12.8
]
"-----------------------"
# Scène 6
# Rect 1
R1XDepartS6=[
-1
,
-1
,
1.5
,
1.5
,
-1
]
R1YDepartS6=[
12.8
,
15.3
,
15.3
,
12.8
,
12.8
]
R1XArriveeS6=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R1YArriveeS6=[
12
,
13.5
,
13.5
,
12.
,
12.
]
# Rect 2
R2XDepartS6=[
5.1
,
5.1
,
7.4
,
7.4
,
5.1
]
R2YDepartS6=[
12.8
,
15
,
15
,
12.8
,
12.8
]
R2XArriveeS6=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R2YArriveeS6=[
12
,
13.5
,
13.5
,
12.
,
12.
]
# Rect 3
R3XDepartS6=[
10
,
10
,
12
,
12
,
10
]
R3YDepartS6=[
12.8
,
15
,
15
,
12.8
,
12.8
]
R3XArriveeS6=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R3YArriveeS6=[
12
,
13.5
,
13.5
,
12.
,
12.
]
"-----------------------"
# Scène 7
# Rect 1
R1XDepartS7=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R1YDepartS7=[
12
,
13.5
,
13.5
,
12.
,
12.
]
R1XArriveeS7=[
0
,
13.6
,
13.6
,
0
,
0
]
R1YArriveeS7=[
0
,
0
,
13.6
,
13.6
,
0
]
# Rect 2
R2XDepartS7=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R2YDepartS7=[
12
,
13.5
,
13.5
,
12.
,
12.
]
R2XArriveeS7=[
0
,
13.6
,
13.6
,
0
,
0
]
R2YArriveeS7=[
0
,
0
,
13.6
,
13.6
,
0
]
# Rect 3
R3XDepartS7=[
2.3
,
2.3
,
3.9
,
3.9
,
2.3
]
R3YDepartS7=[
12
,
13.5
,
13.5
,
12.
,
12.
]
R3XArriveeS7=[
0
,
13.6
,
13.6
,
0
,
0
]
R3YArriveeS7=[
0
,
0
,
13.6
,
13.6
,
0
]
"""--------------------------------------------------------------"""
fig, ax = plt.subplots()
ax.axis(
"off"
)
ax.axis(
"equal"
)
artists=[]
"""Scène 1 : logo ndlr aux personnages"""
for
i
in
range(
1
, nbEtapes +
2
):
r1 = outils.modificationTriangle(ax,i,R1XDepartS1,R1YDepartS1,R1XArriveeS1,R1YArriveeS1,nbEtapes,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XDepartS1,R2YDepartS1,R2XArriveeS1,R2YArriveeS1,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XDepartS1,R3YDepartS1,R3XArriveeS1,R3YArriveeS1,nbEtapes,
"blue"
)
t1=outils.modificationTriangle(ax,i,T1XDepartS1,T1YDepartS1,T1XArriveeS1,T1YArriveeS1,nbEtapes,
"gold"
,WArrivee=
3
)
t2=outils.modificationTriangle(ax,i,T2XDepartS1,T2YDepartS1,T2XArriveeS1,T2YArriveeS1,nbEtapes,
"orange"
,WArrivee=
3
)
t3=outils.modificationTriangle(ax,i,T3XDepartS1,T3YDepartS1,T3XArriveeS1,T3YArriveeS1,nbEtapes,
"darkred"
,WArrivee=
3
)
texte = outils.mouvTexte(ax,i,
5
,
5.5
,
10
,
5.5
,nbEtapes,
"black"
,texte=
"Vive la Rentrée !!"
)
#ax.text(10, 20, r" ")
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 2 : personnages à la table"""
for
i
in
range(
1
, nbEtapes +
2
):
#ax.text(10, 20, r"Le premier cours est toujours un peu ennuyant")
t1 = outils.modificationTriangle(ax,i,T1XArriveeS1,T1YArriveeS1,T1XArriveeS1,T1YArriveeS1,nbEtapes,
"gold"
,WArrivee=
3
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS1,T2YArriveeS1,T2XArriveeS1,T2YArriveeS1,nbEtapes,
"orange"
,WArrivee=
3
)
t3=outils.modificationTriangle(ax,i,TableXDepart,TableYDepart,TableXArrivee,TableYArrivee,nbEtapes,
"darkred"
,WArrivee=
3
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS1,R1YArriveeS1,R1XArriveeS1,R1YArriveeS1,nbEtapes,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS1,R2YArriveeS1,R2XArriveeS1,R2YArriveeS1,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XArriveeS1,R3YArriveeS1,R2XArriveeS1,R2YArriveeS1,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
1
,
5.5
,
2
,
5.5
,nbEtapes,
"black"
,texte=
"Le 1er cours est toujours un peu ennuyant"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 2 : pause"""
for
i
in
range(
1
,
20
+
2
):
#ax.text(10, 20, r"Le premier cours est toujours un peu ennuyant")
t1 = outils.modificationTriangle(ax,i,T1XArriveeS1,T1YArriveeS1,T1XArriveeS1,T1YArriveeS1,
20
,
"gold"
,WArrivee=
3
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS1,T2YArriveeS1,T2XArriveeS1,T2YArriveeS1,
20
,
"orange"
,WArrivee=
3
)
t3=outils.modificationTriangle(ax,i,TableXArrivee,TableYArrivee,TableXArrivee,TableYArrivee,
20
,
"darkred"
,WArrivee=
3
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS1,R1YArriveeS1,R1XArriveeS1,R1YArriveeS1,
20
,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS1,R2YArriveeS1,R2XArriveeS1,R2YArriveeS1,
20
,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R2XArriveeS1,R2YArriveeS1,R2XArriveeS1,R2YArriveeS1,
20
,
"blue"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 3: interrogation"""
for
i
in
range(
1
, nbEtapes +
2
):
#ax.text(10, 20, r"Les adolescents s'interrogent toujours sur tout, en particulier dans les moments de solitude")
t1 = outils.modificationTriangle(ax,i,T1XDepartS3,T1YDepartS3,T1XArriveeS3,T1YArriveeS3,nbEtapes,
"silver"
,WArrivee=
3
)
t2 = outils.modificationTriangle(ax,i,T2XDepartS3,T2YDepartS3,T2XArriveeS3,T2YArriveeS3,nbEtapes,
"orange"
,WArrivee=
3
)
t3 = outils.modificationTriangle(ax,i,T3XDepartS3,T3YDepartS3,T3XArriveeS3,T3YArriveeS3,nbEtapes,
"darkred"
,WArrivee=
4
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS1,R1YArriveeS1,R1XArriveeS3,R1YArriveeS3,nbEtapes,
"silver"
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS1,R2YArriveeS1,R2XArriveeS3,R2YArriveeS3,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R2XArriveeS1,R2YArriveeS1,R3XArriveeS3,R3YArriveeS3,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
-8
,
5.5
,
-8
,
5.5
,nbEtapes,
"black"
,texte=
"Les adolescents s'interrogent toujours sur tout, en particulier dans les moments de solitude"
)
#ax.text(10, 20, r" ")
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 3: pause"""
for
i
in
range(
1
,
20
+
2
):
#ax.text(10, 20, r"Les adolescents s'interrogent toujours sur tout, en particulier dans les moments de solitude")
t1 = outils.modificationTriangle(ax,i,T1XArriveeS3,T1YArriveeS3,T1XArriveeS3,T1YArriveeS3,
20
,
"silver"
,WArrivee=
4
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS3,T2YArriveeS3,T2XArriveeS3,T2YArriveeS3,
20
,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XArriveeS3,T3YArriveeS3,T3XArriveeS3,T3YArriveeS3,
20
,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS3,R1YArriveeS3,R1XArriveeS3,R1YArriveeS3,
20
,
"silver"
,WArrivee=
4
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS3,R2YArriveeS3,R2XArriveeS3,R2YArriveeS3,
20
,
"silver"
)
r3 = outils.modificationTriangle(ax,i,R3XArriveeS3,R3YArriveeS3,R3XArriveeS3,R3YArriveeS3,
20
,
"silver"
)
texte = outils.mouvTexte(ax,i,
-8
,
5.5
,
-8
,
5.5
,nbEtapes,
"black"
,texte=
"Les adolescents s'interrogent toujours sur tout, en particulier dans les moments de solitude"
)
#ax.text(10, 20, r" ")
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 4: vide """
for
i
in
range(
1
, nbEtapes +
2
):
t1 = outils.modificationTriangle(ax,i,T1XDepartS4,T1YDepartS4,T1XArriveeS4,T1YArriveeS4,nbEtapes,
"silver"
,WArrivee=
4
)
t2 = outils.modificationTriangle(ax,i,T2XDepartS4,T2YDepartS4,T2XArriveeS4,T2YArriveeS4,nbEtapes,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XDepartS4,T3YDepartS4,T3XArriveeS4,T3YArriveeS4,nbEtapes,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XDepartS4,R1YDepartS4,R1XArriveeS4,R1YArriveeS4,nbEtapes,
"silver"
,WArrivee=
4
)
r2 = outils.modificationTriangle(ax,i,R2XDepartS4,R2YDepartS4,R2XArriveeS4,R2YArriveeS4,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XDepartS4,R3YDepartS4,R3XArriveeS4,R3YArriveeS4,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
-5
,
5.5
,
-5
,
5.5
,nbEtapes,
"black"
,texte=
"On peut tous se sentir vide, même quand on est entouré"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 4: pause """
for
i
in
range(
1
,
50
+
2
):
t1 = outils.modificationTriangle(ax,i,T1XArriveeS4,T1YArriveeS4,T1XArriveeS4,T1YArriveeS4,
50
,
"silver"
,WArrivee=
4
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS4,T2YArriveeS4,T2XArriveeS4,T2YArriveeS4,
50
,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XArriveeS4,T3YArriveeS4,T3XArriveeS4,T3YArriveeS4,
50
,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS4,R1YArriveeS4,R1XArriveeS4,R1YArriveeS4,
50
,
"silver"
,WArrivee=
4
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS4,R2YArriveeS4,R2XArriveeS4,R2YArriveeS4,
50
,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XArriveeS4,R3YArriveeS4,R3XArriveeS4,R3YArriveeS4,
50
,
"blue"
)
texte = outils.mouvTexte(ax,i,
-5
,
5.5
,
-5
,
5.5
,nbEtapes,
"black"
,texte=
"On peut tous se sentir vide, même quand on est entouré"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 5 : rencontre"""
for
i
in
range(
1
, nbEtapes +
2
):
t1 = outils.modificationTriangle(ax,i,T1XArriveeS4,T1YArriveeS4,T1XArriveeS5,T1YArriveeS5,nbEtapes,
"gold"
,WArrivee=
2
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS4,T2YArriveeS4,T2XArriveeS5,T2YArriveeS5,nbEtapes,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XArriveeS4,T3YArriveeS4,T3XArriveeS5,T3YArriveeS5,nbEtapes,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XDepartS5,R1YDepartS5,R1XArriveeS5,R1YArriveeS5,nbEtapes,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XDepartS5,R2YDepartS5,R2XArriveeS5,R2YArriveeS5,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XDepartS5,R3YDepartS5,R3XArriveeS5,R3YArriveeS5,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
5
,
5.5
,
5
,
5.5
,nbEtapes,
"black"
,texte=
"Nous faisons également des rencontres"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 6 : diplome"""
for
i
in
range(
1
, nbEtapes +
2
):
t1 = outils.modificationTriangle(ax,i,T1XArriveeS5,T1YArriveeS5,T1XArriveeS6,T1YArriveeS6,nbEtapes,
"gold"
,WArrivee=
2
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS5,T2YArriveeS5,T2XArriveeS6,T2YArriveeS6,nbEtapes,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XDepartS6,T3YDepartS6,T3XArriveeS6,T3YArriveeS6,nbEtapes,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XDepartS6,R1YDepartS6,R1XArriveeS6,R1YArriveeS6,nbEtapes,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XDepartS6,R2YDepartS6,R2XArriveeS6,R2YArriveeS6,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XDepartS6,R3YDepartS6,R3XArriveeS6,R3YArriveeS6,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
5
,
5.5
,
5
,
5.5
,nbEtapes,
"black"
,texte=
"Puis on finit par avoir le BAC"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""scène 6 : pause"""
for
i
in
range(
1
,
50
+
2
):
t1 = outils.modificationTriangle(ax,i,T1XArriveeS6,T1YArriveeS6,T1XArriveeS6,T1YArriveeS6,
50
,
"gold"
,WArrivee=
2
)
t2 = outils.modificationTriangle(ax,i,T2XArriveeS6,T2YArriveeS6,T2XArriveeS6,T2YArriveeS6,
50
,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XArriveeS6,T3YArriveeS6,T3XArriveeS6,T3YArriveeS6,
50
,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XArriveeS6,R1YArriveeS6,R1XArriveeS6,R1YArriveeS6,
50
,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XArriveeS6,R2YArriveeS6,R2XArriveeS6,R2YArriveeS6,
50
,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XArriveeS6,R3YArriveeS6,R3XArriveeS6,R3YArriveeS6,
50
,
"blue"
)
texte = outils.mouvTexte(ax,i,
5
,
5.5
,
5
,
5.5
,nbEtapes,
"black"
,texte=
"Puis on finit par avoir le BAC"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
"""Scène 7 : Retour NDLR"""
for
i
in
range(
1
, nbEtapes +
2
):
t1 = outils.modificationTriangle(ax,i,T1XDepartS7,T1YDepartS7,T1XArriveeS7,T1YArriveeS7,nbEtapes,
"gold"
,WArrivee=
2
)
t2 = outils.modificationTriangle(ax,i,T2XDepartS7,T2YDepartS7,T2XArriveeS7,T2YArriveeS7,nbEtapes,
"orange"
,WArrivee=
2
)
t3 = outils.modificationTriangle(ax,i,T3XDepartS7,T3YDepartS7,T3XArriveeS7,T3YArriveeS7,nbEtapes,
"darkred"
,WArrivee=
2
)
r1 = outils.modificationTriangle(ax,i,R1XDepartS7,R1YDepartS7,R1XArriveeS7,R1YArriveeS7,nbEtapes,
"blue"
)
r2 = outils.modificationTriangle(ax,i,R2XDepartS7,R2YDepartS7,R2XArriveeS7,R2YArriveeS7,nbEtapes,
"blue"
)
r3 = outils.modificationTriangle(ax,i,R3XDepartS7,R3YDepartS7,R3XArriveeS7,R3YArriveeS7,nbEtapes,
"blue"
)
texte = outils.mouvTexte(ax,i,
5
,
5.5
,
5
,
5.5
,nbEtapes,
"black"
,texte=
" NDLR"
)
artists.append([t1,t2,t3,r1,r2,r3,texte])
ani = ArtistAnimation(fig, artists, interval=
0.5
, repeat=
True
,blit=
True
)
#fig.show()
from
matplotlib.animation
import
PillowWriter
ani.save(
"Gif.gif"
, writer=PillowWriter(fps=
30
))
### Module outils.py
import
matplotlib.pyplot
as
plt
import
numpy
as
np
from
matplotlib.animation
import
FuncAnimation
def
modificationTriangle
(ax,etape,xDepart,yDepart,xArrivee,yArrivee,nbEtapes,couleur,WDepart=
2
,WArrivee=
2
)
:
xDepart, yDepart, xArrivee, yArrivee = np.array(xDepart), np.array(yDepart), np.array(xArrivee), np.array(yArrivee)
#Les coordonées pour chaque étape sont calculées en fonction des valeurs de XD, YD et XA, YA,
# permettant une transition progressive des points entre les deux polygones.
xInter = xDepart + etape * (xArrivee - xDepart) /(nbEtapes +
1
)
yInter = yDepart + etape * (yArrivee - yDepart) / (nbEtapes +
1
)
WInter = WDepart + etape * (WArrivee - WDepart) / (nbEtapes +
1
)
line = ax.plot(xInter, yInter, couleur,lw = WInter)[
0
]
return
line
def
mouvTexte
(ax,etape,xDepart,yDepart,xArrivee,yArrivee,nbEtapes,couleur,texte,WDepart=
2
,WArrivee=
2
)
:
#Les coordonées pour chaque étape sont calculées en fonction des valeurs de XD, YD et XA, YA,
# permettant une transition progressive des points entre les deux polygones.
xInter = xDepart + etape * (xArrivee - xDepart) /(nbEtapes +
1
)
yInter = yDepart + etape * (yArrivee - yDepart) / (nbEtapes +
1
)
WInter = WDepart + etape * (WArrivee - WDepart) / (nbEtapes +
1
)
line = ax.text(xInter, yInter, s=texte)
return
line
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
matplotlib.animation
import
ArtistAnimation
class
Triangle
:
def
__init__
(self,point_1, point_2, point_3)
:
self.point_1 = point_1
self.point_2 = point_2
self.point_3 = point_3
def
dessiner_triangle
(self)
:
x1= self.point_1[
0
]
y1= self.point_1[
1
]
x2= self.point_2[
0
]
y2= self.point_2[
1
]
x3= self.point_3[
0
]
y3= self.point_3[
1
]
X = [x1,x2,x3,x1]
Y = [y1,y2,y3,y1]
return
X,Y
class
carre
:
def
__init__
(self,point_1, point_2, point_3,point_4)
:
self.point_1 = point_1
self.point_2 = point_2
self.point_3 = point_3
self.point_4 = point_4
def
mouvement
(self,modif_1,modif_2)
:
Triangle.translation( modif_1)
Triangle.rotation( modif_2)
def
dessiner_carre
(self)
:
x1= self.point_1[
0
]
y1= self.point_1[
1
]
x2= self.point_2[
0
]
y2= self.point_2[
1
]
x3= self.point_3[
0
]
y3= self.point_3[
1
]
x4= self.point_4[
0
]
y4= self.point_4[
1
]
X = [x1,x2,x3,x4,x1]
Y = [y1,y2,y3,y4,y1]
return
X,Y
nbEtapes =
70
#couleur= "red"
mon_triangle = Triangle((
0
,
8.9
),(
-0.8
,
11.8
),(
9
,
17.4
))
X, Y = mon_triangle.dessiner_triangle()
mon_triangle = Triangle((
0.4
,
5.9
),(
1.5
,
12
),(
10.1
,
14.1
))
X1, Y1 = mon_triangle.dessiner_triangle()
mon_triangle = Triangle((
0.6
,
4.1
),(
2
,
8
),(
11.5
,
10.3
))
X2, Y2 = mon_triangle.dessiner_triangle()
mon_carre = carre((
0
,
0
),(
0
,
16
),(
20
,
16
),(
20
,
0
))
X3, Y3 = mon_carre.dessiner_carre()
#mon_triangle.deformation(np.array([4, 14, 7, 5, 9, 16]),np.array([16, 7, 9, 6, 10, 11]))
fig, ax = plt.subplots()
### AJOUT PAR ISAAC AIN
plt.axis(
'equal'
)
plt.axis(
'off'
)
#########
#ax.fill(X3, Y3,c = "blue")
#ax.fill(X2, Y2, c = "red")
#ax.fill(X1, Y1, c = "orange")
#ax.fill(X, Y, c = "yellow")
#line, = plt.plot([], [])
taille = len(X)
NbreDefor =
150
def
modification
(ax,xDepart,yDepart,xArrivee,yArrivee,nbEtapes,couleur)
:
xDepart, yDepart, xArrivee, yArrivee = np.array(xDepart), np.array(yDepart), np.array(xArrivee), np.array(yArrivee)
artists = []
for
etape
in
range(
1
, nbEtapes +
2
):
#Les coordonées pour chaque étape sont calculées en fonction des valeurs de XD, YD et XA, YA,
# permettant une transition progressive des points entre les deux polygones.
xInter = xDepart + etape * (xArrivee - xDepart) /(nbEtapes +
1
)
yInter = yDepart + etape * (yArrivee - yDepart) / (nbEtapes +
1
)
line = ax.fill(xInter, yInter, couleur)[
0
]
#Les objets de ligne et de remplissage sont ajoutés à la liste d'artistes (artists) pour chaque étape de l'animation.
artists.append(line)
return
artists
def
memeTemps
(liste)
:
artist = []
for
i
in
range(len(liste[
0
])):
artist.append([])
for
element
in
range(len(liste)):
artist[
-1
].append(liste[element][i])
return
artist
def
aggrandissement
(xDepart,yDepart,coef)
:
xDepart, yDepart = np.array(xDepart), np.array(yDepart)
xDepart =xDepart*coef
yDepart=yDepart*coef
return
xDepart,yDepart
new_triangle = Triangle((
5
,
2
),(
8
,
2
),(
8
,
4
))
X_new1 , Y_new1 = new_triangle.dessiner_triangle()
new_triangle1 = Triangle((
10
,
2
),(
13
,
2
),(
10
,
4
))
X_new2 , Y_new2 = new_triangle1.dessiner_triangle()
new_carre = carre((
11
,
4
),(
11
,
9
),(
7
,
9
),(
7
,
4
))
X3_new2 , Y3_new2 = new_carre.dessiner_carre()
X3_new1 , Y3_new1 = aggrandissement(X3,Y3,
0.2
)
new_triangle2 = Triangle((
9
,
9
),(
11
,
12
),(
7
,
12
))
X_new3 , Y_new3 = new_triangle2.dessiner_triangle()
new_triangle4 = Triangle((
5
,
6
),(
7
,
8
),(
5
,
8
))
X_new4 , Y_new4 = new_triangle4.dessiner_triangle()
new_triangle5 = Triangle((
13
,
6
),(
13
,
8
),(
11
,
8
))
X_new5 , Y_new5 = new_triangle5.dessiner_triangle()
new_carre2 = carre((
0
,
0
),(
1
,
20
),(
18
,
20
),(
20
,
0
))
X_new6 , Y_new6 = new_carre2.dessiner_carre()
C2 = modification(ax,X3,Y3,X_new6,Y_new6,nbEtapes,
"green"
)
C1 = modification(ax,X3,Y3,X3_new2,Y3_new2,nbEtapes,
"blue"
)
T1 = modification(ax,X,Y,X_new1,Y_new1,nbEtapes,
"red"
)
T2 = modification(ax,X2,Y2,X_new2,Y_new2,nbEtapes,
"red"
)
T3 = modification(ax,X1,Y1,X_new3, Y_new3,nbEtapes,
"orange"
)
T5 = modification(ax,X,Y,X_new5, Y_new5,nbEtapes,
"yellow"
)
#T4 = modificationTriangle(ax,X1,Y1,X1,X1,nbEtapes,"red")
#C = modificationTriangle(ax,X3,Y3,X3_new1,Y3_new1,nbEtapes,"pink")
#mon_triangle.remove()
T4 = modification(ax,X,Y,X_new4,Y_new4,nbEtapes,
"yellow"
)
ensemble = [C2,C1,T1,T3,T2,T4,T5]
artist1= memeTemps(ensemble)
new_triangle4 = Triangle((
5
,
6
),(
7
,
8
),(
5
,
8
))
X_new4 , Y_new4 = new_triangle4.dessiner_triangle()
new_triangle5 = Triangle((
13
,
6
),(
13
,
8
),(
11
,
8
))
X_new5 , Y_new5 = new_triangle5.dessiner_triangle()
new_carre2 = carre((
0
,
0
),(
1
,
20
),(
18
,
20
),(
20
,
0
))
X_new6 , Y_new6 = new_carre2.dessiner_carre()
new_car = carre((
2
,
2
),(
2
,
18
),(
26
,
18
),(
26
,
2
))
X_ecole1 , Y_ecole1 = new_car.dessiner_carre()
new_car1 = carre((
10
,
2
),(
14
,
2
),(
14
,
10
),(
10
,
10
))
X_ecole2 , Y_ecole2 = new_car1.dessiner_carre()
new_car3 = carre((
14
,
2
),(
18
,
2
),(
18
,
10
),(
14
,
10
))
X_ecole3 , Y_ecole3 = new_car3.dessiner_carre()
#X_ecole4 , Y_ecole4 = aggrandissement(X3,Y3,0.2)
new_car4 = carre((
4
,
12
),(
8
,
12
),(
8
,
16
),(
4
,
16
))
X_ecole4 , Y_ecole4 = new_car4.dessiner_carre()
#new_carre5 = carre((20,12),(24,12),(24,16),(20,16))
#X_ecole5 , Y_ecole5 = new_carre5.dessiner_carre()
#new_triangle = Triangle((9,9),(11,12),(7,12))
#X_ecole5 , Y_ecole5 = new_triangle.dessiner_triangle()
#sleep(1)
new_triangle = Triangle((
2
,
18
),(
12
,
18
),(
7
,
23
))
X_ecole6 , Y_ecole6 = new_triangle.dessiner_triangle()
new_triangle2= Triangle((
16
,
18
),(
26
,
18
),(
21
,
23
))
X_ecole7 , Y_ecole7 = new_triangle2.dessiner_triangle()
new_triangle3 = Triangle((
6
,
18
),(
22
,
18
),(
14
,
26
))
X_ecole8 , Y_ecole8 = new_triangle3.dessiner_triangle()
D1 = modification(ax,X_new6 , Y_new6,X_ecole1 , Y_ecole1 ,nbEtapes,
"green"
)
D2 = modification(ax,X3_new2,Y3_new2,X_ecole2 , Y_ecole2,nbEtapes,
"blue"
)
B1 = modification(ax,X_new1,Y_new1,X_ecole6 , Y_ecole6,nbEtapes,
"red"
)
B2 = modification(ax,X_new3, Y_new3,X_ecole7 , Y_ecole7,nbEtapes,
"orange"
)
B3 = modification(ax,X_new5, Y_new5,X_ecole8 , Y_ecole8,nbEtapes,
"yellow"
)
B4 = modification(ax,X_new4, Y_new4,X_ecole8 , Y_ecole8,nbEtapes,
"yellow"
)
B5 = modification(ax,X_new2,Y_new2,X_ecole6 , Y_ecole6,nbEtapes,
"red"
)
ensemble1 = [B2,B1,D1,B3,D2,B4,B5]
artist2= memeTemps(ensemble1)
new_carre = carre((
5
,
7
),(
5
,
9
),(
3
,
9
),(
3
,
7
))
X_bal1 , Y_bal1 = new_carre.dessiner_carre()
new_carre1 = carre((
14.5
,
24
),(
14.5
,
26
),(
12.5
,
26
),(
12.5
,
24
))
X_bal2 , Y_bal2 = new_carre1.dessiner_carre()
new_carre3 = carre((
24
,
7
),(
24
,
9
),(
22
,
9
),(
22
,
7
))
X_bal3 , Y_bal3 = new_carre3.dessiner_carre()
new_carre4 = carre((
18
,
18
),(
18
,
20
),(
16
,
20
),(
16
,
18
))
X_bal4 , Y_bal4 = new_carre4.dessiner_carre()
#new_carre5 = carre((20,12),(24,12),(24,16),(20,16))
#X_ecole5 , Y_ecole5 = new_carre5.dessiner_carre()
new_triangle = Triangle((
4
,
2
),(
6
,
6
),(
2
,
6
))
X_bal5 , Y_bal5 = new_triangle.dessiner_triangle()
new_triangle1 = Triangle((
13.5
,
19
),(
15.5
,
23
),(
11.5
,
23
))
X_bal6 , Y_bal6 = new_triangle1.dessiner_triangle()
new_triangle2= Triangle((
23
,
2
),(
25
,
6
),(
21
,
6
))
X_bal7 , Y_bal7 = new_triangle2.dessiner_triangle()
#new_triangle3 = Triangle((6,18),(22,18),(14,26))
#X_ecole8 , Y_ecole8 = new_triangle3.dessiner_triangle()
Q1 = modification(ax,X_ecole8 , Y_ecole8,X_bal5 , Y_bal5,nbEtapes,
"yellow"
)
Q2 = modification(ax,X_ecole7 , Y_ecole7,X_bal6 , Y_bal6 ,nbEtapes,
"orange"
)
Q3 = modification(ax,X_ecole6 , Y_ecole6,X_bal7 , Y_bal7,nbEtapes,
"red"
)
Q7 = modification(ax,X_ecole1 , Y_ecole1,X_bal4 , Y_bal4,nbEtapes,
"green"
)
Q4 = modification(ax,X_ecole2 , Y_ecole2,X_bal1 , Y_bal1,nbEtapes,
"blue"
)
Q5 = modification(ax,X_ecole2 , Y_ecole2,X_bal2 , Y_bal2,nbEtapes,
"blue"
)
Q6 = modification(ax,X_ecole2 , Y_ecole2,X_bal3 , Y_bal3,nbEtapes,
"blue"
)
#T4 = modification(ax,X_new4, Y_new4,X_ecole8 , Y_ecole8,nbEtapes,"yellow")
#T5 = modification(ax,X_new2, Y_new2,X_ecole7 , Y_ecole7,nbEtapes,"orange")
ensemble2 = [Q1,Q2,Q3,Q4,Q5,Q6,Q7]
artist3= memeTemps(ensemble2)
new_carre5 = carre((
20
,
2
),(
20
,
4
),(
18
,
4
),(
18
,
2
))
X_bal8 , Y_bal8 = new_carre5.dessiner_carre()
H1 = modification(ax,X_bal4 , Y_bal4,X_bal8 , Y_bal8,nbEtapes,
"green"
)
h1 = modification(ax,X_bal5 , Y_bal5,X_bal5 , Y_bal5,nbEtapes,
"yellow"
)
h2 = modification(ax,X_bal6 , Y_bal6,X_bal6 , Y_bal6 ,nbEtapes,
"orange"
)
h3 = modification(ax,X_bal7 , Y_bal7,X_bal7 , Y_bal7,nbEtapes,
"red"
)
h4 = modification(ax,X_bal1 , Y_bal1,X_bal1 , Y_bal1,nbEtapes,
"blue"
)
h5 = modification(ax,X_bal2 , Y_bal2,X_bal2 , Y_bal2,nbEtapes,
"blue"
)
h6 = modification(ax,X_bal3 , Y_bal3,X_bal3 , Y_bal3,nbEtapes,
"blue"
)
ensemble3 = [H1,h1,h2,h3,h4,h5,h6]
artiste4=memeTemps(ensemble3)
new_carre1 = carre((
12
,
14
),(
14
,
14
),(
14
,
12
),(
12
,
12
))
X_table2 , Y_table2 = new_carre1.dessiner_carre()
new_carre = carre((
2
,
6
),(
5
,
9
),(
21
,
9
),(
24
,
6
))
X_table1 , Y_table1 = new_carre.dessiner_carre()
new_carre3 = carre((
5
,
6
),(
6
,
6
),(
6
,
1
),(
5
,
1
))
X_table3 , Y_table3 = new_carre3.dessiner_carre()
new_carre4 = carre((
7
,
6
),(
8
,
6
),(
8
,
3
),(
7
,
3
))
X_table4 , Y_table4 = new_carre4.dessiner_carre()
#new_carre5 = carre((20,12),(24,12),(24,16),(20,16))
#X_ecole5 , Y_ecole5 = new_carre5.dessiner_carre()
new_triangle = Triangle((
11
,
11
),(
15
,
11
),(
13
,
5
))
X_table5 , Y_table5 = new_triangle.dessiner_triangle()
new_carre5 = carre((
18
,
6
),(
19
,
6
),(
19
,
3
),(
18
,
3
))
X_table6 , Y_table6 = new_carre5.dessiner_carre()
new_carre6 = carre((
20
,
6
),(
21
,
6
),(
21
,
1
),(
20
,
1
))
X_table7 , Y_table7 = new_carre6.dessiner_carre()
new_carre7 = carre((
16
,
7
),(
16
,
8
),(
17
,
8
),(
17
,
7
))
X_table8 , Y_table8 = new_carre7.dessiner_carre()
new_carre8 = carre((
13
,
5
),(
11
,
2
),(
13
,
3.5
),(
15
,
2
))
X_table9 , Y_table9 = new_carre8.dessiner_carre()
p9 = modification(ax,X_bal8 , Y_bal8,X_table1 , Y_table1,nbEtapes,
"green"
)
p10 = modification(ax,X_bal3 , Y_bal3,X_table8 , Y_table8,nbEtapes,
"gold"
)
p11 = modification(ax,X_bal8 , Y_bal8,X_table9 , Y_table9,nbEtapes,
"green"
)
p1 = modification(ax,X_bal5 , Y_bal5,X_table5 , Y_table5,nbEtapes,
"yellow"
)
p2 = modification(ax,X_bal6 , Y_bal6,X_table5 , Y_table5 ,nbEtapes,
"orange"
)
p3 = modification(ax,X_bal7 , Y_bal7,X_table5 , Y_table5,nbEtapes,
"red"
)
p4 = modification(ax,X_bal1 , Y_bal1,X_table2 , Y_table2,nbEtapes,
"blue"
)
p5 = modification(ax,X_bal2 , Y_bal2,X_table3 , Y_table3,nbEtapes,
"blue"
)
p6 = modification(ax,X_bal3 , Y_bal3,X_table4 , Y_table4,nbEtapes,
"blue"
)
p7 = modification(ax,X_bal3 , Y_bal3,X_table7 , Y_table7,nbEtapes,
"blue"
)
p8 = modification(ax,X_bal3 , Y_bal3,X_table6 , Y_table6,nbEtapes,
"blue"
)
ensemble4 = [p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11]
artist5=memeTemps(ensemble4)
new_carre = carre((
4
,
4
),(
22
,
4
),(
22
,
26
),(
4
,
26
))
X_note1 , Y_note1 = new_carre.dessiner_carre()
new_carre1 = carre((
6
,
17
),(
12
,
17
),(
12
,
19
),(
6
,
19
))
X_note2 , Y_note2 = new_carre1.dessiner_carre()
new_carre3 = carre((
10
,
16
),(
12
,
16
),(
12
,
17
),(
10
,
17
))
X_note3 , Y_note3 = new_carre3.dessiner_carre()
new_carre4 = carre((
6
,
14
),(
12
,
14
),(
12
,
16
),(
6
,
16
))
X_note4 , Y_note4 = new_carre4.dessiner_carre()
new_triangle = Triangle((
15
,
15
),(
15
,
16
),(
16
,
15
))
X_note5 , Y_note5 = new_triangle.dessiner_triangle()
new_carre5 = carre((
6
,
13
),(
8
,
13
),(
8
,
14
),(
6
,
14
))
X_note6 , Y_note6 = new_carre5.dessiner_carre()
new_carre6 = carre((
6
,
11
),(
12
,
11
),(
12
,
13
),(
6
,
13
))
X_note7 , Y_note7 = new_carre6.dessiner_carre()
new_carre7 = carre((
14
,
17
),(
20
,
17
),(
20
,
19
),(
14
,
19
))
X_note8 , Y_note8 = new_carre7.dessiner_carre()
new_carre8 = carre((
14
,
13
),(
16
,
13
),(
16
,
17
),(
14
,
17
))
X_note9 , Y_note9 = new_carre8.dessiner_carre()
new_carre9 = carre((
18
,
13
),(
20
,
13
),(
20
,
17
),(
18
,
17
))
X_note10 , Y_note10 = new_carre9.dessiner_carre()
new_carre10 = carre((
14
,
11
),(
20
,
11
),(
20
,
13
),(
14
,
13
))
X_note11 , Y_note11 = new_carre10.dessiner_carre()
n10 = modification(ax,X_table8 , Y_table8,X_note1 , Y_note1,nbEtapes,
"gold"
)
n2 = modification(ax,X_table2 , Y_table2,X_note4 , Y_note4,nbEtapes,
"orange"
)
n9 = modification(ax,X_table1 , Y_table1,X_note2 , Y_note2,nbEtapes,
"green"
)
n11 = modification(ax,X_table7 , Y_table7,X_note3 , Y_note3,nbEtapes,
"green"
)
n1 = modification(ax,X_table3 , Y_table3,X_note6 , Y_note6,nbEtapes,
"yellow"
)
n3 = modification(ax,X_table5 , Y_table5,X_note5 , Y_note5,nbEtapes,
"red"
)
n4 = modification(ax,X_table2 , Y_table2,X_note8 , Y_note8,nbEtapes,
"black"
)
n5 = modification(ax,X_table3 , Y_table3,X_note9 , Y_note9,nbEtapes,
"red"
)
n6 = modification(ax,X_table9 , Y_table9,X_note11 , Y_note11,nbEtapes,
"green"
)
n12 = modification(ax,X_table4 , Y_table4,X_note11 , Y_note11,nbEtapes,
"blue"
)
n7 = modification(ax,X_table7 , Y_table7,X_note10 , Y_note10,nbEtapes,
"teal"
)
p8 = modification(ax,X_bal3 , Y_bal3,X_note7 , Y_note7,nbEtapes,
"blue"
)
ensemble5 = [n1,n2,n3,n4,n5,n6,n7,n9,n10,n11,p8,n12]
artist6=memeTemps(ensemble5)
a12 = modification(ax,X_note1 , Y_note1,X3, Y3,nbEtapes,
"white"
)
a1 = modification(ax,X_note8 , Y_note8,X3, Y3,nbEtapes,
"green"
)
a2 = modification(ax,X_note8 , Y_note8,X3, Y3,nbEtapes,
"blue"
)
a6 = modification(ax,X_note7 , Y_note7,X3, Y3,nbEtapes,
"blue"
)
a7 = modification(ax,X_note6 , Y_note6,X3, Y3,nbEtapes,
"blue"
)
a9 = modification(ax,X_note4 , Y_note4,X3, Y3,nbEtapes,
"blue"
)
a10 = modification(ax,X_note3 , Y_note3,X3, Y3,nbEtapes,
"blue"
)
a11 = modification(ax,X_note2 , Y_note2,X3, Y3,nbEtapes,
"blue"
)
a15 = modification(ax,X_note9 , Y_note9,X3, Y3,nbEtapes,
"blue"
)
a13 = modification(ax,X_note10 , Y_note10,X3, Y3,nbEtapes,
"blue"
)
a14 = modification(ax,X_note11 , Y_note11,X3, Y3,nbEtapes,
"blue"
)
a5 = modification(ax,X_note5 , Y_note5,X2, Y2,nbEtapes,
"red"
)
a3 = modification(ax,X_note5 , Y_note5,X1, Y1,nbEtapes,
"orange"
)
a4 = modification(ax,X_note5 , Y_note5,X, Y,nbEtapes,
"yellow"
)
#a6 = modification(ax,X_bal3 , Y_bal3,X_new5, Y_new5,nbEtapes,"yellow")
#ax.fill(X3, Y3,c = "blue")
#ax.fill(X2, Y2, c = "red")
#ax.fill(X1, Y1, c = "orange")
#ax.fill(X, Y, c = "yellow")
ensemble6 = [a1,a2,a3,a4,a5,a6,a7,a9,a10,a11,a12,a13,a14,a15]
artist7=memeTemps(ensemble6)
artist = artist1+artist2+artist3+artiste4+artist5+artist6 + artist7
ani = ArtistAnimation(fig, artist, repeat=
False
, interval=
1
)
#plt.show()
from
matplotlib.animation
import
PillowWriter
ani.save(
"Larry-Rayane-Briac-Theo v2.gif"
, writer=PillowWriter(fps=
60
))
import
matplotlib.pyplot
as
plt
from
matplotlib.animation
import
ArtistAnimation
import
numpy
as
np
from
math
import
*
frames =
100
def
movefigurefill
(X,Y,Xtarget,Ytarget,frames,c)
:
animation=[]
for
frame
in
range(
1
,frames+
2
):
NewFigureX = X + frame * (Xtarget - X) / (frames+
1
)
NewFigureY = Y + frame * (Ytarget - Y) / (frames+
1
)
animation.append([ax.fill(NewFigureX, NewFigureY, c=c)[
0
]])
for
_
in
range(
20
):
animation.append(([ax.fill(Xtarget, Ytarget, c=c)[
0
]]))
return
animation
def
movefigurefillcolor
(X,Y,Xtarget,Ytarget,frames,CD,CF)
:
#CD est la couleur de départ er CF la couleur de fin
animation=[]
for
frame
in
range(
1
,frames+
2
):
NewFigureX = X + frame * (Xtarget - X) / (frames+
1
)
NewFigureY = Y + frame * (Ytarget - Y) / (frames+
1
)
NewC = CD + frame * (CF - CD) / (frames +
1
)
animation.append([ax.fill(NewFigureX, NewFigureY, c=NewC)[
0
]])
for
_
in
range(
20
):
animation.append(([ax.fill(Xtarget, Ytarget, c=CF)[
0
]]))
return
animation
def
movefigureplot
(X,Y,Xtarget,Ytarget,frames,c,ls=
'-'
,lw=
1
)
:
animation=[]
for
frame
in
range(
1
,frames+
2
):
NewFigureX = X + frame * (Xtarget - X) / (frames+
1
)
NewFigureY = Y + frame * (Ytarget - Y) / (frames+
1
)
animation.append([ax.plot(NewFigureX, NewFigureY, c=c, ls=ls, lw=lw)[
0
]])
for
_
in
range(
20
):
animation.append(([ax.plot(Xtarget, Ytarget, c=c, ls=ls, lw=lw)[
0
]]))
return
animation
def
movetext
(X,Y,Xtarget,Ytarget,frames)
:
animation=[]
for
frame
in
range(
1
,frames+
2
):
NewFigureX = X + frame * (Xtarget - X) / (frames+
1
)
NewFigureY = Y + frame * (Ytarget - Y) / (frames+
1
)
animation.append([ax.text(NewFigureX, NewFigureY, s=
"NDLR"
, size=
35
, weight=
500
, c=
"white"
)])
for
_
in
range(
20
):
animation.append([ax.text(Xtarget, Ytarget, s=
"NDLR"
, size=
35
, weight=
500
, c=
"white"
)])
return
animation
def
cercle
(xcentre,ycentre,rayon)
:
cercleX=np.array([])
cercleY=np.array([])
for
angle
in
range(
362
):
cercleX = np.hstack((cercleX,np.array([xcentre+cos(radians(angle))*rayon])))
cercleY = np.hstack((cercleY,np.array([ycentre+sin(radians(angle))*rayon])))
return
cercleX,cercleY
fig, ax = plt.subplots()
# Logo nldr
c1x=np.array([
0
,
0
,
13.6
,
13.6
,
13.6
,
0
,
0
])
c1y=np.array([
0
,
0
,
0
,
13.6
,
13.6
,
13.6
,
0
])
tJx=np.array([
0
,
-0.8
,
9
,
0
])
tJy=np.array([
7.9
,
11.8
,
17.4
,
7.9
])
tOx=np.array([
0.4
,
2
,
10.3
,
0.4
])
tOy=np.array([
5.9
,
11.7
,
14.1
,
5.9
])
tRx=np.array([
0.6
,
0.6
,
11.5
,
2.85
,
0.6
])
tRy=np.array([
4.1
,
4.1
,
10.3
,
9.2
,
4.1
,])
ax.axis(
"equal"
)
ax.axis(
"off"
)
ax.set_xlim(
0
,
18
)
ax.set_ylim(
0
,
18
)
carre, = ax.fill(c1x, c1y, c=
"blue"
)
triangleR, = ax.fill(tRx, tRy, c=
"red"
)
triangleO, = ax.fill(tOx, tOy, c=
"orange"
)
triangleJ, = ax.fill(tJx, tJy, c=
"yellow"
)
NDLR = ax.text(
6
,
2
, s=
"NDLR"
, size=
35
, weight=
500
, c=
"white"
)
plt.pause(
1
)
# coodonnés de la prochaine étape
Xchemin=np.array([
2
,
2
,
13
,
10
,
5
,
5
,
2
])*
2
-7
Ychemin=np.array([
0
,
0
,
0
,
10
,
10
,
10
,
0
])*
2
jambex=np.array([
-0.25
,
1
,
2.25
,
1
,
-0.25
])+
5
jambey=np.array([
0
,
2
,
0
,
4.5
,
0
])
bras1x=np.array([
-0.25
,
1
,
1
,
-0.25
])+
5
bras1y=np.array([
4
,
4.5
,
5.5
,
4
])
bras2x=np.array([
1
,
1
,
2.25
,
1
])+
5
bras2y=np.array([
5.5
,
4.5
,
4
,
5.5
])
centre_tete_x=
0
centre_tete_y=
14
taille_tete=
0
tete1x,tete1y = cercle(centre_tete_x,centre_tete_y,taille_tete)
centre_tete_x=
1
+
5
centre_tete_y=
6.5
taille_tete=
0.75
tete2x,tete2y = cercle(centre_tete_x,centre_tete_y,taille_tete)
# supression des figures tracés
triangleR.remove()
triangleJ.remove()
triangleO.remove()
carre.remove()
NDLR.remove()
# animation
animationcarre = movefigurefill(c1x,c1y,Xchemin,Ychemin,frames,
"blue"
)
animationNDLR = movetext(
6
,
2
,
14
,
-10
,frames)
animationtriangleR = movefigurefill(tRx,tRy,jambex,jambey,frames,
"red"
)
animationtriangleO = movefigurefill(tOx,tOy,bras2x,bras2y,frames,
"orange"
)
animationtriangleJ = movefigurefill(tJx,tJy,bras1x,bras1y,frames,
"yellow"
)
animationtete = movefigurefill(tete1x,tete1y,tete2x,tete2y,frames,(
1
,
225
/
255
,
205
/
255
))
animation = [animationtriangleR[i] +
animationtriangleO[i] +
animationtriangleJ[i] +
animationcarre[i] +
animationNDLR[i] +
animationtete[i]
for
i
in
range(frames+
21
)]
# etape 3
animationcarre = movefigurefill(Xchemin,Ychemin,Xchemin,Ychemin,frames,
"blue"
)
animationtriangleR = movefigurefill(jambex,jambey,jambex,jambey,frames,
"red"
)
animationtriangleO = movefigurefill(bras2x,bras2y,bras2x,bras2y,frames,
"orange"
)
animationtriangleJ = movefigurefill(bras1x,bras1y,bras1x,bras1y,frames,
"yellow"
)
animationtete = movefigurefill(tete2x,tete2y,tete2x,tete2y,frames,(
1
,
225
/
255
,
205
/
255
))
#dnnés copain
copain_jambeX, copain_jambeY = jambex+
5
,jambey
copain_bras1X, copain_bras1Y = bras1x+
5
,bras1y
copain_bras2X, copain_bras2Y = bras2x+
5
,bras2y
copain_teteX, copain_teteY = tete2x+
5
,tete2y
lignesRouteX=np.array([
8
,
8
])
lignesRouteY=np.array([
21
,
100
])
lignesRouteAnimation=movefigureplot(lignesRouteX,lignesRouteY,lignesRouteX,lignesRouteY
-30
, frames,
"white"
,ls=
"--"
, lw=
5
)
copain_animationtriangleR = movefigurefillcolor(jambex,jambey,copain_jambeX, copain_jambeY,frames,np.array((
1
,
0
,
0
)),np.array((
156
/
255
,
10
/
255
,
134
/
255
)))
copain_animationtriangleO = movefigurefillcolor(bras2x,bras2y,copain_bras2X, copain_bras2Y,frames,np.array((
1
,
1
/
2
,
0
)), np.array((
244
/
255
,
85
/
255
,
212
/
255
)))
copain_animationtriangleJ = movefigurefillcolor(bras1x,bras1y,copain_bras1X, copain_bras1Y,frames,np.array((
1
,
1
,
0
)), np.array((
244
/
255
,
85
/
255
,
212
/
255
)))
copain_animationtete = movefigurefill(tete2x,tete2y,copain_teteX, copain_teteY,frames,(
1
,
225
/
255
,
205
/
255
))
animation += [animationtriangleR[i] +
animationtriangleO[i] +
animationtriangleJ[i] +
animationcarre[i] +
animationtete[i]+
copain_animationtriangleR[i] +
copain_animationtriangleO[i] +
copain_animationtriangleJ[i] +
copain_animationtete[i] +
lignesRouteAnimation[i]
for
i
in
range(frames+
21
)]
# estape 4
Xlivre=np.array([
4
,
6.5
,
9
,
9
,
6.5
,
4
,
4
])*
1.5
-1.7
Ylivre=np.array([
9
,
8.5
,
9
,
14
,
13.5
,
14
,
9
])*
1.5
-7
jambeX3, jambeY3 = jambex*
1.2
-4
,jambey*
1.2
bras1X3, bras1Y3 = bras1x*
1.2
-4
,bras1y*
1.2
bras2X3, bras2Y3 = bras2x*
1.2
-4
,bras2y*
1.2
teteX3, teteY3 = tete2x*
1.2
-4
,tete2y*
1.2
ligne1X = np.array([
4.25
,
6.25
]*
181
)+
0.9
ligne1Y = np.array([
13
,
12.6
]*
181
)
-3
ligne2X = np.array([
6.75
,
8.75
]*
2
+[
6.75
])+
2.4
ligne2Y = np.array([
12.6
,
13
]*
2
+[
12.6
])
-1
ligne3X = np.array([
6.75
,
8.75
]*
2
)+
2.4
ligne3Y = np.array([
12.6
,
13
]*
2
)
-3
ligne4X = np.array([
6.75
,
8.75
]*
2
)+
2.4
ligne4Y = np.array([
12.6
,
13
]*
2
)
-5
animationcarre = movefigurefillcolor(Xchemin,Ychemin,Xlivre,Ylivre,frames,np.array((
0
,
0
,
1
)),np.array((
255
/
300
,
250
/
300
,
180
/
300
)))
lignesRouteAnimation=movefigureplot(lignesRouteX,lignesRouteY
-30
,lignesRouteX,lignesRouteY
-30
, frames,
"white"
,ls=
"--"
, lw=
5
)
lignesLivreAnimation=movefigureplot(lignesRouteX,lignesRouteY,lignesRouteX,lignesRouteY
-30
, frames,
"white"
, lw=
5
)
animationtriangleR = movefigurefill(jambex,jambey,jambeX3, jambeY3,frames,
"red"
)
animationtriangleO = movefigurefill(bras2x,bras2y,bras2X3, bras2Y3,frames,
"orange"
)
animationtriangleJ = movefigurefill(bras1x,bras1y,bras1X3, bras1Y3,frames,
"yellow"
)
animationtete = movefigurefill(tete2x,tete2y,teteX3, teteY3,frames,(
1
,
225
/
255
,
205
/
255
))
copain_animationtete = movefigurefillcolor(copain_teteX, copain_teteY,ligne1X,ligne1Y,frames,np.array((
1
,
225
/
255
,
205
/
255
)),np.array((
0
,
0
,
0
)))
copain_animationtriangleR = movefigurefillcolor(copain_jambeX, copain_jambeY,ligne2X,ligne2Y,frames,np.array((
156
/
255
,
10
/
255
,
134
/
255
)),np.array((
0
,
0
,
0
)))
copain_animationtriangleO = movefigurefillcolor(copain_bras2X, copain_bras2Y,ligne3X,ligne3Y,frames,np.array((
244
/
255
,
85
/
255
,
212
/
255
)), np.array((
0
,
0
,
0
)))
copain_animationtriangleJ = movefigurefillcolor(copain_bras1X, copain_bras1Y,ligne4X,ligne4Y,frames,np.array((
244
/
255
,
85
/
255
,
212
/
255
)), np.array((
0
,
0
,
0
)))
animation += [animationtriangleR[i] +
animationtriangleO[i] +
animationtriangleJ[i] +
animationcarre[i] +
animationtete[i]+
lignesRouteAnimation[i] +
lignesLivreAnimation[i] +
copain_animationtete[i] +
copain_animationtriangleO[i] +
copain_animationtriangleJ[i] +
copain_animationtriangleR[i]
for
i
in
range(frames+
21
)]
#étape5
Xchapeau=np.array([
0.5
,
0.5
,
0.5
,
1.5
,
1.5
,
0.5
,
0.5
])*
2
+
5
Ychapeau=np.array([
7
,
7
,
8
,
8
,
7
,
7
,
7
])*
2
Xhaut=np.array([
0.15
,
1.85
]*
2
)*
2
+
5
Yhaut=np.array([
8
,
8
]*
2
)*
2
xQ=np.array([
1.85
,
2
,
2.15
,
1.85
])*
2
+
5
yQ=np.array([
8
,
7.25
,
7.5
,
8
])*
2
jambe4x=np.array([
-0.25
,
1
,
2.25
,
1
,
-0.25
])*
2
+
5
jambe4y=np.array([
0
,
2
,
0
,
4.5
,
0
])*
2
bras1x=np.array([
-0.25
,
1
,
1
,
-0.25
])*
2
+
5
bras1y=np.array([
4
,
4.5
,
5.5
,
4
])*
2
bras2x=np.array([
1
,
1
,
2.25
,
1
])*
2
+
5
bras2y=np.array([
5.5
,
4.5
,
4
,
5.5
])*
2
tetemilieuX=
1
tetemilieuY=
6.5
tailletete=
0.75
tete4x,tete4y = cercle(tetemilieuX,tetemilieuY,tailletete)
tete4x,tete4y = tete4x*
2
+
5
,tete4y*
2
lignesLivreAnimation=movefigureplot(lignesRouteX,lignesRouteY
-90
,lignesRouteX,lignesRouteY
-140
, frames,
"white"
, lw=
5
)
animationcarre = movefigurefillcolor(Xlivre,Ylivre,Xchapeau,Ychapeau,frames,np.array((
255
/
300
,
250
/
300
,
180
/
300
)),np.array((
0
,
0
,
0
)))
copain_animationtriangleJ = movefigurefill(ligne4X,ligne4Y,Xhaut,Yhaut,frames,(
0
,
0
,
0
))
copain_animationtriangleO = movefigurefillcolor(ligne3X,ligne3Y,xQ,yQ,frames,np.array((
0
,
0
,
0
)), np.array((
1
,
0
,
0
)))
animationtriangleR = movefigurefill(jambeX3, jambeY3,jambe4x,jambe4y,frames,
"red"
)
animationtriangleO = movefigurefill(bras2X3, bras2Y3,bras2x,bras2y,frames,
"orange"
)
animationtriangleJ = movefigurefillcolor(bras1X3, bras1Y3,bras1x,bras1y,frames,np.array((
1
,
1
,
0
)),np.array((
1
,
0.5
,
0
)))
animationtete = movefigurefill(teteX3, teteY3,tete4x,tete4y,frames,(
1
,
225
/
255
,
205
/
255
))
animation += [animationcarre[i] +
animationtriangleR[i] +
animationtriangleO[i] +
animationtriangleJ[i] +
animationtete[i] +
copain_animationtriangleJ[i]+
lignesLivreAnimation[i]+
copain_animationtriangleO[i]
for
i
in
range(frames+
21
)]
# etape retour
chapeau_xr, chapeau_yr = Xchapeau,Ychapeau
trianglec_xr, trianglec_yr = xQ,yQ
bras_1xr,bras_2xr,bras_1yr,bras_2yr = bras1x,bras2x,bras1y,bras2y
jambes_xr,jambes_yr = jambe4x,jambe4y
tete_xr, tet_yr = tete4x,tete4y
carreFinX=np.array([
0
,
0
,
13.6
,
13.6
])
carreFinY=np.array([
0
,
13.6
,
13.6
,
0
])
tetemilieuX=
14
tetemilieuY=
0
tailletete=
0
tete_xr,tete_yr = cercle(tetemilieuX,tetemilieuY,tailletete)
animationcarre = movefigurefillcolor(chapeau_xr, chapeau_yr,c1x,c1y,frames,np.array((
0
,
0
,
0
)),np.array((
0
,
0
,
1
)))
animationcarre2 = movefigurefillcolor(Xhaut,Yhaut,carreFinX,carreFinY,frames,np.array((
0
,
0
,
0
)),np.array((
0
,
0
,
1
)))
animationNDLR = movetext(
14
,
-10
,
6
,
2
,frames)
animationtriangleR = movefigurefill(jambes_xr,jambes_yr,tRx,tRy,frames,
"red"
)
animationtriangleO1 = movefigurefill(bras_1xr,bras_1yr,tOx,tOy,frames,
"orange"
)
animationtriangleO2 = movefigurefill(bras_2xr,bras_2yr,tOx,tOy,frames,
"orange"
)
animationtriangleJ = movefigurefillcolor(trianglec_xr, trianglec_yr,tJx,tJy,frames,np.array((
1
,
0
,
0
)),np.array((
1
,
1
,
0
)))
animationtete = movefigurefill(tete4x,tete4y,tete_xr,tete_yr,frames,(
1
,
225
/
255
,
205
/
255
))
animation += [animationcarre[i] +
animationtete[i] +
animationcarre2[i]+
animationtriangleR[i] +
animationtriangleO1[i] +
animationtriangleO2[i] +
animationNDLR[i] +
animationtriangleJ[i]
for
i
in
range(frames+
21
)]
ani = ArtistAnimation(fig,animation, repeat=
True
, interval=
1
)
plt.show()
# from matplotlib.animation import PillowWriter
# ani.save("GilbertAdventure.gif", writer=PillowWriter(fps=30))
### Programme principal
import
toolbox
as
tb
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.animation
as
animation
posXjaune, posYjaune = [np.array([
0.0
,
-2.0
,
14.0
,
0.0
]), np.array([
6.0
,
7.0
,
6.0
,
6.0
,
5.0
,
5.0
,
4.0
,
5.0
,
6.0
]), np.array([
3.0
,
4.0
,
5.0
,
6.0
,
7.0
,
8.0
,
6.0
,
8.0
,
6.0
,
7.0
,
7.0
,
6.0
,
5.0
,
4.0
,
4.0
,
5.0
,
2.0
,
5.0
,
3.0
]),np.array([
2.0
,
2.0
,
3.0
,
5.0
,
4.0
,
4.0
,
5.0
,
6.0
,
7.0
,
7.0
,
6.0
,
8.0
,
9.0
,
9.0
,
2.0
]),np.array([
5.0
,
5.0
,
6.0
,
9.0
,
7.0
,
7.0
,
9.0
,
11.0
,
13.0
,
13.0
,
11.0
,
14.0
,
15.0
,
15.0
,
5.0
]),np.array([
2.0
,
1.0
,
2.0
,
2.0
,
4.0
,
4.0
,
5.0
,
4.0
,
2.0
]) ,np.array([
0.0
,
-2.0
,
14.0
,
0.0
])],[np.array([
12.0
,
17.5
,
24.0
,
12.0
]),np.array([
0.0
,
4.0
,
4.0
,
5.0
,
5.0
,
4.0
,
4.0
,
0.0
,
0.0
]),np.array([
0.0
,
0.0
,
2.0
,
2.0
,
0.0
,
0.0
,
4.0
,
10.0
,
10.0
,
11.0
,
12.0
,
13.0
,
13.0
,
12.0
,
11.0
,
10.0
,
10.0
,
4.0
,
0.0
]),np.array([
7.0
,
9.0
,
10.0
,
10.0
,
11.0
,
12.0
,
13.0
,
13.0
,
12.0
,
11.0
,
10.0
,
10.0
,
9.0
,
7.0
,
7.0
]),np.array([
0.0
,
3.0
,
5.0
,
5.0
,
7.0
,
9.0
,
11.0
,
11.0
,
9.0
,
7.0
,
5.0
,
5.0
,
3.0
,
0.0
,
0.0
]),np.array([
0.0
,
5.0
,
5.0
,
7.0
,
7.0
,
5.0
,
5.0
,
0.0
,
0.0
]),np.array([
12.0
,
17.5
,
24.0
,
12.0
])]
posXorange, posYorange = [ np.array([
1.25
,
2.0
,
15.0
,
1.25
]),np.array([
10.0
,
11.0
,
12.0
,
12.0
,
11.0
,
10.0
,
9.0
,
9.0
,
10.0
]), np.array([
8.5
,
9.0
,
10.0
,
11.0
,
11.5
,
11.0
,
10.0
,
9.0
,
8.5
]),np.array([
1.0
,
1.0
,
19.0
,
19.0
,
17.0
,
17.0
,
3.0
,
3.0
,
1.0
]),np.array([
14.0
,
13.0
,
13.0
,
14.0
,
14.2
,
13.2
,
13.4
,
14.4
,
14.6
,
13.8
,
14.0
,
14.8
,
15.0
,
14.9
,
15.2
,
15.5
,
15.7
,
16.0
,
16.0
,
15.0
,
15.0
,
14.0
,
14.0
,
15.0
,
16.0
,
17.0
,
17.0
,
16.0
,
15.0
,
14.0
]), np.array([
0.0
,
2.0
,
4.0
,
6.0
,
4.0
,
3.0
,
1.0
,
2.0
,
4.0
,
2.0
,
0.0
,
0.0
]) ,np.array([
1.25
,
2.0
,
15.0
,
1.25
])], [np.array([
8.0
,
16.0
,
21.0
,
8.0
]),np.array([
20.0
,
20.0
,
19.0
,
18.0
,
17.0
,
17.0
,
18.0
,
19.0
,
20.0
]), np.array([
3.0
,
2.0
,
1.5
,
2.0
,
3.0
,
4.0
,
4.5
,
4.0
,
3.0
]),np.array([
0.0
,
7.0
,
7.0
,
0.0
,
0.0
,
2.0
,
2.0
,
0.0
,
0.0
]),np.array([
13.0
,
13.0
,
14.0
,
13.0
,
13.2
,
14.4
,
14.6
,
13.4
,
13.6
,
14.8
,
15.0
,
13.8
,
14.0
,
14.4
,
14.5
,
15.0
,
14.6
,
15.0
,
15.5
,
15.4
,
15.0
,
15.0
,
16.0
,
17.0
,
17.0
,
16.0
,
15.0
,
14.0
,
14.0
,
13.0
]),np.array([
15.0
,
13.0
,
13.0
,
15.0
,
14.0
,
14.0
,
16.0
,
18.0
,
19.0
,
19.0
,
17.0
,
15.0
]),np.array([
8.0
,
16.0
,
21.0
,
8.0
])]
posXrouge, posYrouge = [np.array([
3.0
,
4.5
,
16.5
,
3.0
]), np.array([
2.0
,
2.0
,
7.0
,
7.0
,
9.0
,
17.0
,
19.0
,
19.0
,
7.0
,
7.0
,
4.0
,
4.0
,
2.0
]), np.array([
12.0
,
13.0
,
14.0
,
15.0
,
16.0
,
17.0
,
15.0
,
17.0
,
15.0
,
16.0
,
16.0
,
15.0
,
14.0
,
13.0
,
13.0
,
14.0
,
11.0
,
14.0
,
12.0
]),np.array([
12.0
,
12.0
,
13.0
,
14.0
,
13.0
,
13.0
,
14.0
,
15.0
,
16.0
,
16.0
,
15.0
,
16.0
,
17.0
,
17.0
,
12.0
]),np.array([
10.0
,
10.5
,
10.0
,
10.0
,
10.0
,
9.5
,
10.0
,
10.0
,
11.0
,
12.0
,
11.0
,
10.25
,
10.0
,
9.75
,
9.0
,
8.0
,
9.0
,
10.0
]), np.array([
1.75
,
1.75
,
2.0
,
2.0
,
4.0
,
4.0
,
4.25
,
4.25
,
4.0
,
2.0
,
1.75
]), np.array([
3.0
,
4.5
,
16.5
,
3.0
])],[np.array([
6.0
,
13.0
,
16.0
,
6.0
]), np.array([
0.0
,
8.0
,
8.0
,
10.0
,
12.0
,
12.0
,
10.0
,
0.0
,
0.0
,
6.0
,
6.0
,
0.0
,
0.0
]),np.array([
0.0
,
0.0
,
2.0
,
2.0
,
0.0
,
0.0
,
4.0
,
10.0
,
10.0
,
11.0
,
12.0
,
13.0
,
13.0
,
12.0
,
11.0
,
10.0
,
10.0
,
4.0
,
0.0
]),np.array([
7.0
,
8.0
,
9.0
,
9.0
,
10.0
,
11.0
,
12.0
,
12.0
,
11.0
,
10.0
,
9.0
,
9.0
,
8.0
,
7.0
,
7.0
]),np.array([
7.75
,
7.5
,
7.25
,
4.0
,
7.25
,
7.5
,
7.75
,
7.85
,
7.0
,
8.0
,
10.0
,
10.0
,
9.5
,
10.0
,
10.0
,
8.0
,
7.0
,
7.85
]), np.array([
1.0
,
5.0
,
5.0
,
4.0
,
4.0
,
5.0
,
5.0
,
1.0
,
2.0
,
2.0
,
1.0
]), np.array([
6.0
,
13.0
,
16.0
,
6.0
])]
posXbleu, posYbleu = [np.array([
0
,
20
,
20
,
0
,
0
]),np.array([
0.0
,
20.0
,
20.0
,
19.0
,
19.0
,
18.0
,
18.0
,
16.0
,
16.0
,
13.0
,
13.0
,
11.0
,
11.0
,
8.0
,
8.0
,
6.0
,
6.0
,
4.0
,
4.0
,
0.0
,
0.0
]), np.array([
0.0
,
3.0
,
5.0
,
4.0
,
6.0
,
8.0
,
10.0
,
11.0
,
9.0
,
10.0
,
11.0
,
12.0
,
14.0
,
13.0
,
13.0
,
14.0
,
16.0
,
17.0
,
18.0
,
19.0
,
18.0
,
19.0
,
20.0
,
20.0
,
0.0
,
0.0
]),np.array([
8.0
,
9.0
,
10.5
,
10.5
,
13.0
,
12.0
,
10.5
,
10.5
,
8.0
]) ,np.array([
10.0
,
10.0
,
13.5
,
13.0
,
11.0
,
10.0
,
10.0
,
6.5
,
7.0
,
9.0
,
10.0
,
10.05
,
9.95
,
9.95
,
9.0
,
6.0
,
7.0
,
13.0
,
14.0
,
11.0
,
10.0
]), np.array([
0.0
,
0.0
,
20.0
,
20.0
,
10.0
,
10.0
,
8.0
,
8.0
,
9.0
,
9.0
,
10.0
,
10.0
,
20.0
,
20.0
,
10.0
,
10.0
,
20.0
,
20.0
,
10.0
,
10.0
,
11.0
,
11.0
,
14.0
,
14.0
,
19.0
,
19.0
,
20.0
,
20.0
,
19.0
,
19.0
,
13.0
,
13.0
,
8.0
,
8.0
,
9.0
,
9.0
,
8.0
,
7.0
,
6.0
,
6.0
,
7.0
,
7.0
,
0.0
]), np.array([
0
,
20
,
20
,
0
,
0
])], [np.array([
0
,
0
,
20
,
20
,
0
]),np.array([
0.0
,
0.0
,
20.0
,
20.0
,
19.0
,
19.0
,
14.0
,
14.0
,
19.0
,
19.0
,
15.0
,
15.0
,
17.0
,
17.0
,
18.0
,
18.0
,
14.0
,
14.0
,
20.0
,
20.0
,
0.0
]),np.array([
18.0
,
20.0
,
18.0
,
17.0
,
16.0
,
18.0
,
19.0
,
18.0
,
17.0
,
16.0
,
17.0
,
17.0
,
16.0
,
17.0
,
18.0
,
19.0
,
19.0
,
18.0
,
19.0
,
18.0
,
17.0
,
16.0
,
17.0
,
0.0
,
0.0
,
18.0
]),np.array([
4.0
,
6.0
,
6.0
,
4.0
,
4.0
,
6.0
,
6.0
,
4.0
,
4.0
]),np.array([
1.05
,
2.0
,
2.8
,
2.05
,
2.05
,
1.05
,
2.0
,
2.8
,
2.05
,
2.05
,
1.05
,
0.05
,
0.05
,
1.0
,
2.0
,
2.0
,
0.0
,
0.0
,
2.0
,
2.0
,
1.05
]),np.array([
0.0
,
20.0
,
20.0
,
18.0
,
18.0
,
17.0
,
17.0
,
14.0
,
14.0
,
16.0
,
16.0
,
15.0
,
15.0
,
14.0
,
14.0
,
6.0
,
6.0
,
5.0
,
5.0
,
4.0
,
4.0
,
3.0
,
3.0
,
4.0
,
4.0
,
3.0
,
3.0
,
0.0
,
0.0
,
2.0
,
2.0
,
0.0
,
0.0
,
8.0
,
9.0
,
11.0
,
12.0
,
12.0
,
11.0
,
9.0
,
8.0
,
0.0
,
0.0
]) , np.array([
0
,
0
,
20
,
20
,
0
])]
posXtext, posYtext = [np.array([
40
,
40
,
40
,
40
]),np.array([
10.0
,
10.0
,
11.0
,
11.5
,
11.5
,
12.25
,
12.25
,
12.8
,
13.3
,
13.3
,
12.8
,
12.25
,
12.25
,
13.4
,
14.0
,
14.0
,
14.75
,
14.75
,
16.0
,
16.0
,
16.75
,
16.75
,
17.5
,
17.5
,
16.75
,
16.75
,
17.0
,
18.0
,
18.0
,
17.0
,
18.0
,
17.25
,
16.5
,
16.5
,
14.0
,
14.0
,
13.0
,
11.5
,
11.0
,
11.0
,
10.0
])],[np.array([
5.5
,
5.5
,
5.5
,
5.5
]),np.array([
5.5
,
10.0
,
10.0
,
8.0
,
10.0
,
10.0
,
6.25
,
6.25
,
7.0
,
8.4
,
9.25
,
9.25
,
10.0
,
10.0
,
8.5
,
10.0
,
10.0
,
6.25
,
6.25
,
10.0
,
10.0
,
7.8
,
8.3
,
8.9
,
9.4
,
10.0
,
10.0
,
9.25
,
8.25
,
7.5
,
5.5
,
5.5
,
7.25
,
5.5
,
5.5
,
7.0
,
5.5
,
5.5
,
7.5
,
5.5
,
5.5
])]
xmin =
0
xmax =
5
nbx =
151
x = np.linspace(xmin, xmax, nbx)
fig = plt.figure()
# initialise la figure
linejaune, = plt.plot([], [],color=
"C8"
)
lineorange, = plt.plot([], [],color=
"C1"
)
linerouge, = plt.plot([], [],color=
"C3"
)
linebleu, = plt.plot([], [],color=
"C0"
)
linetext, = plt.plot([], [],color=
"C0"
)
plt.axis(
'equal'
)
plt.axis(
'off'
)
plt.xlim(
-15
,
35
)
plt.ylim(
-15
,
35
)
def
init
()
:
linejaune.set_data(posXjaune[
0
], posYjaune[
0
])
lineorange.set_data(posXorange[
0
], posYorange[
0
])
linerouge.set_data(posXrouge[
0
], posYrouge[
0
])
linebleu.set_data(posXbleu[
0
], posYbleu[
0
])
return
linejaune,
def
animate
(i)
:
I_tempo = int(str(i /
100
)[
0
])
-1
I_inter_tempo = int((i /
100
- (I_tempo+
1
))*
100
)
if
I_tempo ==
-1
:
Xaparjaune, Yaparjaune = posXjaune[
0
], posYjaune[
0
]
Xaparorange, Yaparorange = posXorange[
0
], posYorange[
0
]
Xaparrouge, Yaparrouge = posXrouge[
0
], posYrouge[
0
]
Xaparbleu, Yaparbleu = posXbleu[
0
], posYbleu[
0
]
else
:
if
I_inter_tempo <
80
:
X1 = posXjaune[I_tempo]
X2 = posXjaune[I_tempo +
1
]
Y1 = posYjaune[I_tempo]
Y2 = posYjaune[I_tempo +
1
]
Xaparjaune, Yaparjaune = tb.calcule_cordonne(X1,Y1,X2,Y2,I_inter_tempo*
1.25
)
X1 = posXorange[I_tempo]
X2 = posXorange[I_tempo +
1
]
Y1 = posYorange[I_tempo]
Y2 = posYorange[I_tempo +
1
]
Xaparorange, Yaparorange = tb.calcule_cordonne(X1,Y1,X2,Y2,I_inter_tempo*
1.25
)
X1 = posXrouge[I_tempo]
X2 = posXrouge[I_tempo +
1
]
Y1 = posYrouge[I_tempo]
Y2 = posYrouge[I_tempo +
1
]
Xaparrouge, Yaparrouge = tb.calcule_cordonne(X1,Y1,X2,Y2,I_inter_tempo*
1.25
)
X1 = posXbleu[I_tempo]
X2 = posXbleu[I_tempo +
1
]
Y1 = posYbleu[I_tempo]
Y2 = posYbleu[I_tempo +
1
]
Xaparbleu, Yaparbleu = tb.calcule_cordonne(X1,Y1,X2,Y2,I_inter_tempo*
1.25
)
else
:
Xaparjaune, Yaparjaune = X2 = posXjaune[I_tempo +
1
] ,posYjaune[I_tempo+
1
]
Xaparorange, Yaparorange = X2 = posXorange[I_tempo +
1
] ,posYorange[I_tempo+
1
]
Xaparrouge, Yaparrouge = X2 = posXrouge[I_tempo +
1
] ,posYrouge[I_tempo+
1
]
Xaparbleu, Yaparbleu = X2 = posXbleu[I_tempo +
1
] ,posYbleu[I_tempo+
1
]
if
I_tempo ==
0
or
I_tempo ==
5
:
X1 = posXtext[I_tempo ==
0
]
X2 = posXtext[
not
I_tempo ==
0
]
Y1 = posYtext[I_tempo ==
0
]
Y2 = posYtext[
not
I_tempo ==
0
]
Xapartext, Yapartext = tb.calcule_cordonne(X1,Y1,X2,Y2,I_inter_tempo)
else
:
Xapartext, Yapartext = X2 = posXtext[I_tempo ==
-1
] ,posYtext[I_tempo ==
-1
]
linetext.set_data(Xapartext, Yapartext)
linejaune.set_data(Xaparjaune, Yaparjaune)
lineorange.set_data(Xaparorange, Yaparorange)
linerouge.set_data(Xaparrouge, Yaparrouge)
linebleu.set_data(Xaparbleu, Yaparbleu)
return
linejaune
ani = animation.FuncAnimation(fig, animate, init_func=init, frames=
700
,
interval=
25
, blit=
False
, repeat=
True
)
#plt.show()
from
matplotlib.animation
import
PillowWriter
ani.save(
"Malo-Julie-Yann-Arthus v1.gif"
, writer=PillowWriter(fps=
30
))
### Module toolbox.py
import
numpy
as
np
def
division_trait
(x1, y1, x2, y2, coeff)
:
dX = x2 - x1
dY = y2 - y1
Xnew = x1 + dX* coeff
Ynew = y1 + dY* coeff
return
Xnew, Ynew
def
calcule_cordonne
(X1,Y1,X2,Y2,dist)
:
len1,len2 = len(X1), len(X2)
while
not
len1 == len2 :
if
len1 < len2:
Xnew, Ynew =division_trait(X1[
0
],Y1[
0
],X1[
1
],Y1[
1
],
0.5
)
X1 = np.insert(X1,
1
,Xnew)
Y1 = np.insert(Y1,
1
,Ynew)
elif
len2 < len1:
#gg well play
Xnew, Ynew =division_trait(X2[
0
],Y2[
0
],X2[
1
],Y2[
1
],
0.5
)
X2 = np.insert(X2,
1
,Xnew)
Y2 = np.insert(Y2,
1
,Ynew)
len1,len2 = len(X1), len(X2)
return
division_trait(X1, Y1, X2, Y2, dist/
100
)
#return [1,2] , [2,3]
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
matplotlib.animation
import
ArtistAnimation
from
random
import
random, randint
nbEtapes =
60
artists = []
#animation 1
XDC = [
0
,
0
,
14
,
14
]
YDC = [
0
,
14
,
14
,
0
]
XAC = [
0
,
20
,
20
,
0
]
YAC = [
20
,
20
,
-2
,
-2
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XDTJ1 = [
-0.8
,
9
,
0
,
0
]
YDTJ1 = [
13
,
17.4
,
8.9
,
8.9
]
XATJ1 = [
14.5
,
14.5
,
14.2
,
14.2
]
YATJ1 = [
6
,
3
,
3
,
6
]
XDTJ1, YDTJ1, XATJ1, YATJ1 = np.array(XDTJ1), np.array(YDTJ1), np.array(XATJ1), np.array(YATJ1)
CDTJ1 = [
1
,
0.85
,
0
]
CATJ1 = [
1
,
0.85
,
0
]
CDTJ1, CATJ1 = np.array(CDTJ1), np.array(CATJ1)
XDTJ2 = [
-0.8
,
9
,
0
,
-0.8
]
YDTJ2 = [
13
,
17.4
,
8.9
,
13
]
XATJ2 = [
14.5
,
14.5
,
14.2
,
14.5
]
YATJ2 = [
3
,
2
,
3
,
3
]
XDTJ2, YDTJ2, XATJ2, YATJ2 = np.array(XDTJ2), np.array(YDTJ2), np.array(XATJ2), np.array(YATJ2)
CDTJ2 = [
1
,
0.85
,
0
]
CATJ2 = [
0
,
0
,
0
]
CDTJ2, CATJ2 = np.array(CDTJ2), np.array(CATJ2)
XDTR1 = [
1.7
,
10.7
,
0.5
,
1.7
]
YDTR1 = [
8
,
11
,
3.5
,
8
]
XATR1 = [
9
,
9
,
5
,
5
]
YATR1 = [
8
,
2
,
1
,
7
]
XDTR1, YDTR1, XATR1, YATR1 = np.array(XDTR1), np.array(YDTR1), np.array(XATR1), np.array(YATR1)
CDTR1 = [
0.82
,
0
,
0
]
CATR1 = [
0.82
,
0
,
0
]
CDTR1, CATR1 = np.array(CDTR1), np.array(CATR1)
XDTR2 = [
1.7
,
10.7
,
0.5
,
1.7
]
YDTR2 = [
8
,
11
,
3.5
,
8
]
XATR2 = [
9
,
9
,
13
,
13
]
YATR2 = [
8
,
2
,
1
,
7
]
XDTR2, YDTR2, XATR2, YATR2 = np.array(XDTR2), np.array(YDTR2), np.array(XATR2), np.array(YATR2)
CDTR2 = [
0.82
,
0
,
0
]
CATR2 = [
0.82
,
0
,
0
]
CDTR2, CATR2 = np.array(CDTR2), np.array(CATR2)
XDTO = [
1.5
,
10.1
,
0.4
,
1.5
]
YDTO = [
12
,
14.1
,
5.9
,
12
]
XATO = [
0.5
,
4.5
,
0.5
,
0.5
]
YATO = [
3
,
6.5
,
6.5
,
3
]
XDTO, YDTO, XATO, YATO = np.array(XDTO), np.array(YDTO), np.array(XATO), np.array(YATO)
CDTO = [
0.98
,
0.59
,
0.2
]
CATO = [
0.98
,
0.59
,
0.2
]
CDTO, CATO = np.array(CDTO), np.array(CATO)
xMax, yMax =
25
,
25
taille_TO = len(XATO)
taille_TR1 = len(XATR1)
taille_TR2 = len(XATR2)
taille_TJ1 = len(XATJ1)
taille_TJ2 = len(XATJ2)
taille_C = len(XAC)
fig, ax = plt.subplots(figsize=(
8
,
8
))
ax.axis(
'equal'
)
ax.axis(
'off'
)
ax.axis([
-5
, xMax,
-5
, yMax])
for
i
in
range (
20
):
artists.append([ax.fill(XDC, YDC, c = CDC)[
0
],ax.fill(XDTR1, YDTR1, c = CDTR1)[
0
], ax.fill(XDTO, YDTO, c = CDTO)[
0
], ax.fill(XDTJ1, YDTJ1, c = CDTJ1)[
0
]])
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR1 = XDTR1 + etape * (XATR1 - XDTR1) / (nbEtapes +
1
)
YRTR1 = YDTR1 + etape * (YATR1 - YDTR1) / (nbEtapes +
1
)
CRTR1 = CDTR1 + etape * (CATR1 - CDTR1) / (nbEtapes +
1
)
color = (CRTR1[
0
], CRTR1[
1
], CRTR1[
2
])
fillTR1 = ax.fill(XRTR1, YRTR1, color=color)[
0
]
XRTR2 = XDTR2 + etape * (XATR2 - XDTR2) / (nbEtapes +
1
)
YRTR2 = YDTR2 + etape * (YATR2 - YDTR2) / (nbEtapes +
1
)
CRTR2 = CDTR2 + etape * (CATR2 - CDTR2) / (nbEtapes +
1
)
color = (CRTR2[
0
], CRTR2[
1
], CRTR2[
2
])
fillTR2 = ax.fill(XRTR2, YRTR2, color=color)[
0
]
XRTO = XDTO + etape * (XATO - XDTO) / (nbEtapes +
1
)
YRTO = YDTO + etape * (YATO - YDTO) / (nbEtapes +
1
)
CRTO = CDTO + etape * (CATO - CDTO) / (nbEtapes +
1
)
color = (CRTO[
0
], CRTO[
1
], CRTO[
2
])
fillTO = ax.fill(XRTO, YRTO, color=color)[
0
]
XRTJ2 = XDTJ2 + etape * (XATJ2 - XDTJ2) / (nbEtapes +
1
)
YRTJ2 = YDTJ2 + etape * (YATJ2 - YDTJ2) / (nbEtapes +
1
)
CRTJ2 = CDTJ2 + etape * (CATJ2 - CDTJ2) / (nbEtapes +
1
)
color = (CRTJ2[
0
], CRTJ2[
1
], CRTJ2[
2
])
fillTJ2 = ax.fill(XRTJ2, YRTJ2, color=color)[
0
]
XRTJ1 = XDTJ1 + etape * (XATJ1 - XDTJ1) / (nbEtapes +
1
)
YRTJ1 = YDTJ1 + etape * (YATJ1 - YDTJ1) / (nbEtapes +
1
)
CRTJ1 = CDTJ1 + etape * (CATJ1 - CDTJ1) / (nbEtapes +
1
)
color = (CRTJ1[
0
], CRTJ1[
1
], CRTJ1[
2
])
fillTJ1 = ax.fill(XRTJ1, YRTJ1, color=color)[
0
]
artists.append([fillTO, fillTR1, fillTR2, fillTJ1, fillTJ2, fillC])
for
i
in
range (
20
):
artists.append([ax.fill(XAC, YAC, c = CAC)[
0
],ax.fill(XATR1, YATR1, c = CATR1)[
0
], ax.fill(XATR2, YATR2, c = CATR2)[
0
], ax.fill(XATJ1, YATJ1, c = CATJ1)[
0
], ax.fill(XATJ2, YATJ2, c = CATJ2)[
0
], ax.fill(XATO, YATO, c = CATO)[
0
]])
#animation 2
XAC = [
0
,
0
,
14
,
14
]
YAC = [
0
,
14
,
14
,
0
]
XDC = [
0
,
20
,
20
,
0
]
YDC = [
20
,
20
,
-2
,
-2
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XATJ1 = [
-0.8
,
9
,
0
,
0
]
YATJ1 = [
13
,
17.4
,
8.9
,
8.9
]
XDTJ1 = [
14.5
,
14.5
,
14.2
,
14.2
]
YDTJ1 = [
6
,
3
,
3
,
6
]
XDTJ1, YDTJ1, XATJ1, YATJ1 = np.array(XDTJ1), np.array(YDTJ1), np.array(XATJ1), np.array(YATJ1)
CDTJ1 = [
1
,
0.85
,
0
]
CATJ1 = [
1
,
0.85
,
0
]
CDTJ1, CATJ1 = np.array(CDTJ1), np.array(CATJ1)
XATJ2 = [
-0.8
,
9
,
0
,
-0.8
]
YATJ2 = [
13
,
17.4
,
8.9
,
13
]
XDTJ2 = [
14.5
,
14.5
,
14.2
,
14.5
]
YDTJ2 = [
3
,
2
,
3
,
3
]
XDTJ2, YDTJ2, XATJ2, YATJ2 = np.array(XDTJ2), np.array(YDTJ2), np.array(XATJ2), np.array(YATJ2)
CATJ2 = [
1
,
0.85
,
0
]
CDTJ2 = [
0
,
0
,
0
]
CDTJ2, CATJ2 = np.array(CDTJ2), np.array(CATJ2)
XATR1 = [
1.7
,
10.7
,
0.5
,
1.7
]
YATR1 = [
8
,
11
,
3.5
,
8
]
XDTR1 = [
9
,
9
,
5
,
5
]
YDTR1 = [
8
,
2
,
1
,
7
]
XDTR1, YDTR1, XATR1, YATR1 = np.array(XDTR1), np.array(YDTR1), np.array(XATR1), np.array(YATR1)
CDTR1 = [
0.82
,
0
,
0
]
CATR1 = [
0.82
,
0
,
0
]
CDTR1, CATR1 = np.array(CDTR1), np.array(CATR1)
XATR2 = [
1.7
,
10.7
,
0.5
,
1.7
]
YATR2 = [
8
,
11
,
3.5
,
8
]
XDTR2 = [
9
,
9
,
13
,
13
]
YDTR2 = [
8
,
2
,
1
,
7
]
XDTR2, YDTR2, XATR2, YATR2 = np.array(XDTR2), np.array(YDTR2), np.array(XATR2), np.array(YATR2)
CDTR2 = [
0.82
,
0
,
0
]
CATR2 = [
0.82
,
0
,
0
]
CDTR2, CATR2 = np.array(CDTR2), np.array(CATR2)
XATO = [
1.5
,
10.1
,
0.4
,
1.5
]
YATO = [
12
,
14.1
,
5.9
,
12
]
XDTO = [
0.5
,
4.5
,
0.5
,
0.5
]
YDTO = [
3
,
6.5
,
6.5
,
3
]
XDTO, YDTO, XATO, YATO = np.array(XDTO), np.array(YDTO), np.array(XATO), np.array(YATO)
CDTO = [
0.98
,
0.59
,
0.2
]
CATO = [
0.98
,
0.59
,
0.2
]
CDTO, CATO = np.array(CDTO), np.array(CATO)
xMax, yMax =
25
,
25
taille_TO = len(XATO)
taille_TR1 = len(XATR1)
taille_TR2 = len(XATR2)
taille_TJ1 = len(XATJ1)
taille_TJ2 = len(XATJ2)
taille_C = len(XAC)
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR1 = XDTR1 + etape * (XATR1 - XDTR1) / (nbEtapes +
1
)
YRTR1 = YDTR1 + etape * (YATR1 - YDTR1) / (nbEtapes +
1
)
CRTR1 = CDTR1 + etape * (CATR1 - CDTR1) / (nbEtapes +
1
)
color = (CRTR1[
0
], CRTR1[
1
], CRTR1[
2
])
fillTR1 = ax.fill(XRTR1, YRTR1, color=color)[
0
]
XRTR2 = XDTR2 + etape * (XATR2 - XDTR2) / (nbEtapes +
1
)
YRTR2 = YDTR2 + etape * (YATR2 - YDTR2) / (nbEtapes +
1
)
CRTR2 = CDTR2 + etape * (CATR2 - CDTR2) / (nbEtapes +
1
)
color = (CRTR2[
0
], CRTR2[
1
], CRTR2[
2
])
fillTR2 = ax.fill(XRTR2, YRTR2, color=color)[
0
]
XRTO = XDTO + etape * (XATO - XDTO) / (nbEtapes +
1
)
YRTO = YDTO + etape * (YATO - YDTO) / (nbEtapes +
1
)
CRTO = CDTO + etape * (CATO - CDTO) / (nbEtapes +
1
)
color = (CRTO[
0
], CRTO[
1
], CRTO[
2
])
fillTO = ax.fill(XRTO, YRTO, color=color)[
0
]
XRTJ2 = XDTJ2 + etape * (XATJ2 - XDTJ2) / (nbEtapes +
1
)
YRTJ2 = YDTJ2 + etape * (YATJ2 - YDTJ2) / (nbEtapes +
1
)
CRTJ2 = CDTJ2 + etape * (CATJ2 - CDTJ2) / (nbEtapes +
1
)
color = (CRTJ2[
0
], CRTJ2[
1
], CRTJ2[
2
])
fillTJ2 = ax.fill(XRTJ2, YRTJ2, color=color)[
0
]
XRTJ1 = XDTJ1 + etape * (XATJ1 - XDTJ1) / (nbEtapes +
1
)
YRTJ1 = YDTJ1 + etape * (YATJ1 - YDTJ1) / (nbEtapes +
1
)
CRTJ1 = CDTJ1 + etape * (CATJ1 - CDTJ1) / (nbEtapes +
1
)
color = (CRTJ1[
0
], CRTJ1[
1
], CRTJ1[
2
])
fillTJ1 = ax.fill(XRTJ1, YRTJ1, color=color)[
0
]
artists.append([fillTO, fillTR1, fillTR2, fillTJ1, fillTJ2, fillC])
#animation_3
XDC = [
0
,
0
,
14
,
14
]
YDC = [
0
,
14
,
14
,
0
]
XAC = [
0
,
20
,
20
,
0
]
YAC = [
10.5
,
10.5
,
0
,
0
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XDTJ = [
-0.8
,
9
,
0
,
-0.8
]
YDTJ = [
13
,
17.4
,
8.9
,
13
]
XATJ = [
5
,
10
,
15
,
5
]
YATJ = [
10.5
,
13.5
,
10.5
,
10.5
]
XDTJ, YDTJ, XATJ, YATJ = np.array(XDTJ), np.array(YDTJ), np.array(XATJ), np.array(YATJ)
CDTJ = [
1
,
0.85
,
0
]
CATJ = [
1
,
0.85
,
0
]
CDTJ, CATJ = np.array(CDTJ), np.array(CATJ)
XDTR = [
1.7
,
10.7
,
0.5
,
1.7
]
YDTR = [
8
,
11
,
3.5
,
8
]
XATR = [
0
,
5
,
10
,
0
]
YATR = [
10.5
,
12.5
,
10.5
,
10.5
]
XDTR, YDTR, XATR, YATR = np.array(XDTR), np.array(YDTR), np.array(XATR), np.array(YATR)
CDTR = [
0.82
,
0
,
0
]
CATR = [
0.82
,
0
,
0
]
CDTR, CATR = np.array(CDTR), np.array(CATR)
XDTO = [
1.5
,
10.1
,
0.4
,
1.5
]
YDTO = [
12
,
14.1
,
5.9
,
12
]
XATO = [
10
,
15
,
20
,
10
]
YATO = [
10.5
,
12.5
,
10.5
,
10.5
]
XDTO, YDTO, XATO, YATO = np.array(XDTO), np.array(YDTO), np.array(XATO), np.array(YATO)
CDTO = [
0.98
,
0.59
,
0.2
]
CATO = [
0.98
,
0.59
,
0.2
]
CDTO, CATO = np.array(CDTO), np.array(CATO)
XATB = [
7.5
,
9.5
,
9.5
,
7.5
]
YATB = [
3
,
3
,
0
,
0
]
XDTB = [
1.5
,
10.1
,
10.1
,
0.4
]
YDTB = [
12
,
14.1
,
14.1
,
5.9
]
XDTB, YDTB, XATB, YATB = np.array(XDTB), np.array(YDTB), np.array(XATB), np.array(YATB)
CATB = [
1
,
1
,
1
]
CDTB = [
0.98
,
0.59
,
0.2
]
CDTB, CATB = np.array(CDTB), np.array(CATB)
xMax, yMax =
25
,
25
taille_TO = len(XATO)
taille_TB = len(XATB)
taille_TR = len(XATR)
taille_TJ = len(XATJ)
taille_C = len(XAC)
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR = XDTR + etape * (XATR - XDTR) / (nbEtapes +
1
)
YRTR = YDTR + etape * (YATR - YDTR) / (nbEtapes +
1
)
CRTR = CDTR + etape * (CATR - CDTR) / (nbEtapes +
1
)
color = (CRTR[
0
], CRTR[
1
], CRTR[
2
])
fillTR = ax.fill(XRTR, YRTR, color=color)[
0
]
XRTO = XDTO + etape * (XATO - XDTO) / (nbEtapes +
1
)
YRTO = YDTO + etape * (YATO - YDTO) / (nbEtapes +
1
)
CRTO = CDTO + etape * (CATO - CDTO) / (nbEtapes +
1
)
color = (CRTO[
0
], CRTO[
1
], CRTO[
2
])
fillTO = ax.fill(XRTO, YRTO, color=color)[
0
]
XRTB = XDTB + etape * (XATB - XDTB) / (nbEtapes +
1
)
YRTB = YDTB + etape * (YATB - YDTB) / (nbEtapes +
1
)
CRTB = CDTB + etape * (CATB - CDTB) / (nbEtapes +
1
)
color = (CRTB[
0
], CRTB[
1
], CRTB[
2
])
fillTB = ax.fill(XRTB, YRTB, color=color)[
0
]
XRTJ = XDTJ + etape * (XATJ - XDTJ) / (nbEtapes +
1
)
YRTJ = YDTJ + etape * (YATJ - YDTJ) / (nbEtapes +
1
)
CRTJ = CDTJ + etape * (CATJ - CDTJ) / (nbEtapes +
1
)
color = (CRTJ[
0
], CRTJ[
1
], CRTJ[
2
])
fillTJ = ax.fill(XRTJ, YRTJ, color=color)[
0
]
artists.append([fillTO, fillTB, fillTR, fillTJ, fillC])
for
i
in
range (
20
):
artists.append([ax.fill(XAC, YAC, c = CAC)[
0
],ax.fill(XATR, YATR, c = CATR)[
0
], ax.fill(XATB, YATB, c = CATB)[
0
], ax.fill(XATO, YATO, c = CATO)[
0
], ax.fill(XATJ, YATJ, c = CATJ)[
0
]])
#animation_4
XDC = [
0
,
20
,
20
,
0
]
YDC = [
10.5
,
10.5
,
0
,
0
]
XAC = [
0
,
0
,
14
,
14
]
YAC = [
0
,
14
,
14
,
0
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XDTJ = [
5
,
10
,
15
,
5
]
YDTJ = [
10.5
,
13.5
,
10.5
,
10.5
]
XATJ = [
-0.8
,
9
,
0
,
-0.8
]
YATJ = [
13
,
17.4
,
8.9
,
13
]
XDTJ, YDTJ, XATJ, YATJ = np.array(XDTJ), np.array(YDTJ), np.array(XATJ), np.array(YATJ)
CDTJ = [
1
,
0.85
,
0
]
CATJ = [
1
,
0.85
,
0
]
CDTJ, CATJ = np.array(CDTJ), np.array(CATJ)
XDTR = [
0
,
5
,
10
,
0
]
YDTR = [
10.5
,
12.5
,
10.5
,
10.5
]
XATR = [
1.7
,
10.7
,
0.5
,
1.7
]
YATR = [
8
,
11
,
3.5
,
8
]
XDTR, YDTR, XATR, YATR = np.array(XDTR), np.array(YDTR), np.array(XATR), np.array(YATR)
CDTR = [
0.82
,
0
,
0
]
CATR = [
0.82
,
0
,
0
]
CDTR, CATR = np.array(CDTR), np.array(CATR)
XDTO = [
10
,
15
,
20
,
10
]
YDTO = [
10.5
,
12.5
,
10.5
,
10.5
]
XATO = [
1.5
,
10.1
,
0.4
,
1.5
]
YATO = [
12
,
14.1
,
5.9
,
12
]
XDTO, YDTO, XATO, YATO = np.array(XDTO), np.array(YDTO), np.array(XATO), np.array(YATO)
CDTO = [
0.98
,
0.59
,
0.2
]
CATO = [
0.98
,
0.59
,
0.2
]
CDTO, CATO = np.array(CDTO), np.array(CATO)
XDTB = [
7.5
,
9.5
,
9.5
,
7.5
]
YDTB = [
3
,
3
,
0
,
0
]
XATB = [
1.5
,
10.1
,
10.1
,
0.4
]
YATB = [
12
,
14.1
,
14.1
,
5.9
]
XDTB, YDTB, XATB, YATB = np.array(XDTB), np.array(YDTB), np.array(XATB), np.array(YATB)
CDTB = [
1
,
1
,
1
]
CATB = [
0.98
,
0.59
,
0.2
]
CDTB, CATB = np.array(CDTB), np.array(CATB)
xMax, yMax =
25
,
25
taille_TO = len(XATO)
taille_TB = len(XATB)
taille_TR = len(XATR)
taille_TJ = len(XATJ)
taille_C = len(XAC)
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR = XDTR + etape * (XATR - XDTR) / (nbEtapes +
1
)
YRTR = YDTR + etape * (YATR - YDTR) / (nbEtapes +
1
)
CRTR = CDTR + etape * (CATR - CDTR) / (nbEtapes +
1
)
color = (CRTR[
0
], CRTR[
1
], CRTR[
2
])
fillTR = ax.fill(XRTR, YRTR, color=color)[
0
]
XRTO = XDTO + etape * (XATO - XDTO) / (nbEtapes +
1
)
YRTO = YDTO + etape * (YATO - YDTO) / (nbEtapes +
1
)
CRTO = CDTO + etape * (CATO - CDTO) / (nbEtapes +
1
)
color = (CRTO[
0
], CRTO[
1
], CRTO[
2
])
fillTO = ax.fill(XRTO, YRTO, color=color)[
0
]
XRTB = XDTB + etape * (XATB - XDTB) / (nbEtapes +
1
)
YRTB = YDTB + etape * (YATB - YDTB) / (nbEtapes +
1
)
CRTB = CDTB + etape * (CATB - CDTB) / (nbEtapes +
1
)
color = (CRTB[
0
], CRTB[
1
], CRTB[
2
])
fillTB = ax.fill(XRTB, YRTB, color=color)[
0
]
XRTJ = XDTJ + etape * (XATJ - XDTJ) / (nbEtapes +
1
)
YRTJ = YDTJ + etape * (YATJ - YDTJ) / (nbEtapes +
1
)
CRTJ = CDTJ + etape * (CATJ - CDTJ) / (nbEtapes +
1
)
color = (CRTJ[
0
], CRTJ[
1
], CRTJ[
2
])
fillTJ = ax.fill(XRTJ, YRTJ, color=color)[
0
]
artists.append([fillTO,fillTB, fillTR, fillTJ, fillC])
#animation 5
XDC = [
0
,
0
,
14
,
14
]
YDC = [
0
,
14
,
14
,
0
]
XAC = [
0
,
20
,
20
,
0
]
YAC = [
20
,
20
,
-2
,
-2
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XDTJ1 = [
-0.8
,
9
,
0
,
-0.8
]
YDTJ1 = [
13
,
17.4
,
8.9
,
13
]
XATJ1 = [
5
,
7
,
9
,
5
]
YATJ1 = [
12
,
6
,
12
,
12
]
XDTJ1, YDTJ1, XATJ1, YATJ1 = np.array(XDTJ1), np.array(YDTJ1), np.array(XATJ1), np.array(YATJ1)
CDTJ1 = [
1
,
0.85
,
0
]
CATJ1 = [
0
,
0.51
,
0
]
CDTJ1, CATJ1 = np.array(CDTJ1), np.array(CATJ1)
XDTJ2 = [
-0.8
,
9
,
0
,
-0.8
]
YDTJ2 = [
13
,
17.4
,
8.9
,
13
]
XATJ2 = [
11
,
13
,
15
,
11
]
YATJ2 = [
12
,
6
,
12
,
12
]
XDTJ2, YDTJ2, XATJ2, YATJ2 = np.array(XDTJ2), np.array(YDTJ2), np.array(XATJ2), np.array(YATJ2)
CDTJ2 = [
1
,
0.85
,
0
]
CATJ2 = [
0.82
,
0
,
0
]
CDTJ2, CATJ2 = np.array(CDTJ2), np.array(CATJ2)
XDTR1 = [
1.7
,
10.7
,
0.5
,
0.5
]
YDTR1 = [
8
,
11
,
3.5
,
3.5
]
XATR1 = [
7
,
9
,
7
,
5
]
YATR1 = [
6
,
4
,
5.5
,
4
]
XDTR1, YDTR1, XATR1, YATR1 = np.array(XDTR1), np.array(YDTR1), np.array(XATR1), np.array(YATR1)
CDTR1 = [
0.82
,
0
,
0
]
CATR1 = [
0.82
,
0
,
0
]
CDTR1, CATR1 = np.array(CDTR1), np.array(CATR1)
XDTR2 = [
1.7
,
10.7
,
0.5
,
0.5
]
YDTR2 = [
8
,
11
,
3.5
,
3.5
]
XATR2 = [
13
,
15
,
13
,
11
]
YATR2 = [
6
,
4
,
5.5
,
4
]
XDTR2, YDTR2, XATR2, YATR2 = np.array(XDTR2), np.array(YDTR2), np.array(XATR2), np.array(YATR2)
CDTR2 = [
0.82
,
0
,
0
]
CATR2 = [
0
,
0.51
,
0
]
CDTR2, CATR2 = np.array(CDTR2), np.array(CATR2)
XDTO1 = [
1.5
,
10.1
,
0.4
,
1.5
]
YDTO1 = [
12
,
14.1
,
5.9
,
12
]
XATO1 = [
6
,
8
,
8
,
6
]
YATO1 = [
14
,
14
,
12
,
12
]
XDTO1, YDTO1, XATO1, YATO1 = np.array(XDTO1), np.array(YDTO1), np.array(XATO1), np.array(YATO1)
CDTO1 = [
0.98
,
0.59
,
0.2
]
CATO1 = [
1
,
0.82
,
0.7
]
CDTO1, CATO1 = np.array(CDTO1), np.array(CATO1)
XDTO2 = [
1.5
,
10.1
,
0.4
,
1.5
]
YDTO2 = [
12
,
14.1
,
5.9
,
12
]
XATO2 = [
12
,
14
,
14
,
12
]
YATO2 = [
14
,
14
,
12
,
12
]
XDTO2, YDTO2, XATO2, YATO2 = np.array(XDTO2), np.array(YDTO2), np.array(XATO2), np.array(YATO2)
CDTO2 = [
0.98
,
0.59
,
0.2
]
CATO2 = [
1
,
0.82
,
0.7
]
CDTO2, CATO2 = np.array(CDTO2), np.array(CATO2)
xMax, yMax =
25
,
25
taille_TO = len(XATO1)
taille_TR = len(XATR1)
taille_TJ = len(XATJ1)
taille_TO = len(XATO2)
taille_TR = len(XATR2)
taille_TJ = len(XATJ2)
taille_C = len(XAC)
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR1 = XDTR1 + etape * (XATR1 - XDTR1) / (nbEtapes +
1
)
YRTR1 = YDTR1 + etape * (YATR1 - YDTR1) / (nbEtapes +
1
)
CRTR1 = CDTR1 + etape * (CATR1 - CDTR1) / (nbEtapes +
1
)
color = (CRTR1[
0
], CRTR1[
1
], CRTR1[
2
])
fillTR1 = ax.fill(XRTR1, YRTR1, color=color)[
0
]
XRTR2 = XDTR2 + etape * (XATR2 - XDTR2) / (nbEtapes +
1
)
YRTR2 = YDTR2 + etape * (YATR2 - YDTR2) / (nbEtapes +
1
)
CRTR2 = CDTR2 + etape * (CATR2 - CDTR2) / (nbEtapes +
1
)
color = (CRTR2[
0
], CRTR2[
1
], CRTR2[
2
])
fillTR2 = ax.fill(XRTR2, YRTR2, color=color)[
0
]
XRTO1 = XDTO1 + etape * (XATO1 - XDTO1) / (nbEtapes +
1
)
YRTO1 = YDTO1 + etape * (YATO1 - YDTO1) / (nbEtapes +
1
)
CRTO1 = CDTO1 + etape * (CATO1 - CDTO1) / (nbEtapes +
1
)
color = (CRTO1[
0
], CRTO1[
1
], CRTO1[
2
])
fillTO1 = ax.fill(XRTO1, YRTO1, color=color)[
0
]
XRTO2 = XDTO2 + etape * (XATO2 - XDTO2) / (nbEtapes +
1
)
YRTO2 = YDTO2 + etape * (YATO2 - YDTO2) / (nbEtapes +
1
)
CRTO2 = CDTO2 + etape * (CATO2 - CDTO2) / (nbEtapes +
1
)
color = (CRTO2[
0
], CRTO2[
1
], CRTO2[
2
])
fillTO2 = ax.fill(XRTO2, YRTO2, color=color)[
0
]
XRTJ1 = XDTJ1 + etape * (XATJ1 - XDTJ1) / (nbEtapes +
1
)
YRTJ1 = YDTJ1 + etape * (YATJ1 - YDTJ1) / (nbEtapes +
1
)
CRTJ1 = CDTJ1 + etape * (CATJ1 - CDTJ1) / (nbEtapes +
1
)
color = (CRTJ1[
0
], CRTJ1[
1
], CRTJ1[
2
])
fillTJ1 = ax.fill(XRTJ1, YRTJ1, color=color)[
0
]
XRTJ2 = XDTJ2 + etape * (XATJ2 - XDTJ2) / (nbEtapes +
1
)
YRTJ2 = YDTJ2 + etape * (YATJ2 - YDTJ2) / (nbEtapes +
1
)
CRTJ2 = CDTJ2 + etape * (CATJ2 - CDTJ2) / (nbEtapes +
1
)
color = (CRTJ2[
0
], CRTJ2[
1
], CRTJ2[
2
])
fillTJ2 = ax.fill(XRTJ2, YRTJ2, color=color)[
0
]
artists.append([fillTO1, fillTO2, fillTR1, fillTR2, fillTJ1, fillTJ2, fillC])
for
i
in
range (
20
):
artists.append([ax.fill(XAC, YAC, c = CAC)[
0
],ax.fill(XATR1, YATR1, c = CATR1)[
0
], ax.fill(XATR2, YATR2, c = CATR2)[
0
], ax.fill(XATJ1, YATJ1, c = CATJ1)[
0
], ax.fill(XATJ2, YATJ2, c = CATJ2)[
0
], ax.fill(XATO1, YATO1, c = CATO1)[
0
], ax.fill(XATO2, YATO2, c = CATO2)[
0
]])
#animation 6
XAC = [
0
,
0
,
14
,
14
]
YAC = [
0
,
14
,
14
,
0
]
XDC = [
0
,
20
,
20
,
0
]
YDC = [
20
,
20
,
-2
,
-2
]
XDC, YDC, XAC, YAC = np.array(XDC), np.array(YDC), np.array(XAC), np.array(YAC)
CDC = [
0
,
0
,
0.63
]
CAC = [
0
,
0
,
0.63
]
CDC, CAC = np.array(CDC), np.array(CAC)
XATJ1 = [
-0.8
,
9
,
0
,
-0.8
]
YATJ1 = [
13
,
17.4
,
8.9
,
13
]
XDTJ1 = [
5
,
7
,
9
,
5
]
YDTJ1 = [
12
,
6
,
12
,
12
]
XDTJ1, YDTJ1, XATJ1, YATJ1 = np.array(XDTJ1), np.array(YDTJ1), np.array(XATJ1), np.array(YATJ1)
CATJ1 = [
1
,
0.85
,
0
]
CDTJ1 = [
0
,
0.51
,
0
]
CDTJ1, CATJ1 = np.array(CDTJ1), np.array(CATJ1)
XATJ2 = [
-0.8
,
9
,
0
,
-0.8
]
YATJ2 = [
13
,
17.4
,
8.9
,
13
]
XDTJ2 = [
11
,
13
,
15
,
11
]
YDTJ2 = [
12
,
6
,
12
,
12
]
XDTJ2, YDTJ2, XATJ2, YATJ2 = np.array(XDTJ2), np.array(YDTJ2), np.array(XATJ2), np.array(YATJ2)
CATJ2 = [
1
,
0.85
,
0
]
CDTJ2 = [
0.82
,
0
,
0
]
CDTJ2, CATJ2 = np.array(CDTJ2), np.array(CATJ2)
XATR1 = [
1.7
,
10.7
,
0.5
,
0.5
]
YATR1 = [
8
,
11
,
3.5
,
3.5
]
XDTR1 = [
7
,
9
,
7
,
5
]
YDTR1 = [
6
,
4
,
5.5
,
4
]
XDTR1, YDTR1, XATR1, YATR1 = np.array(XDTR1), np.array(YDTR1), np.array(XATR1), np.array(YATR1)
CDTR1 = [
0.82
,
0
,
0
]
CATR1 = [
0.82
,
0
,
0
]
CDTR1, CATR1 = np.array(CDTR1), np.array(CATR1)
XATR2 = [
1.7
,
10.7
,
0.5
,
0.5
]
YATR2 = [
8
,
11
,
3.5
,
3.5
]
XDTR2 = [
13
,
15
,
13
,
11
]
YDTR2 = [
6
,
4
,
5.5
,
4
]
XDTR2, YDTR2, XATR2, YATR2 = np.array(XDTR2), np.array(YDTR2), np.array(XATR2), np.array(YATR2)
CATR2 = [
0.82
,
0
,
0
]
CDTR2 = [
0
,
0.51
,
0
]
CDTR2, CATR2 = np.array(CDTR2), np.array(CATR2)
XATO1 = [
1.5
,
10.1
,
0.4
,
1.5
]
YATO1 = [
12
,
14.1
,
5.9
,
12
]
XDTO1 = [
6
,
8
,
8
,
6
]
YDTO1 = [
14
,
14
,
12
,
12
]
XDTO1, YDTO1, XATO1, YATO1 = np.array(XDTO1), np.array(YDTO1), np.array(XATO1), np.array(YATO1)
CATO1 = [
0.98
,
0.59
,
0.2
]
CDTO1 = [
1
,
0.82
,
0.7
]
CDTO1, CATO1 = np.array(CDTO1), np.array(CATO1)
XATO2 = [
1.5
,
10.1
,
0.4
,
1.5
]
YATO2 = [
12
,
14.1
,
5.9
,
12
]
XDTO2 = [
12
,
14
,
14
,
12
]
YDTO2 = [
14
,
14
,
12
,
12
]
XDTO2, YDTO2, XATO2, YATO2 = np.array(XDTO2), np.array(YDTO2), np.array(XATO2), np.array(YATO2)
CATO2 = [
0.98
,
0.59
,
0.2
]
CDTO2 = [
1
,
0.82
,
0.7
]
CDTO2, CATO2 = np.array(CDTO2), np.array(CATO2)
xMax, yMax =
25
,
25
taille_TO = len(XATO1)
taille_TR = len(XATR1)
taille_TJ = len(XATJ1)
taille_TO = len(XATO2)
taille_TR = len(XATR2)
taille_TJ = len(XATJ2)
taille_C = len(XAC)
for
etape
in
range(
1
, nbEtapes +
2
):
XRC = XDC + etape * (XAC - XDC) / (nbEtapes +
1
)
YRC = YDC + etape * (YAC - YDC) / (nbEtapes +
1
)
CRC = CDC + etape * (CAC - CDC) / (nbEtapes +
1
)
color = (CRC[
0
], CRC[
1
], CRC[
2
])
fillC = ax.fill(XRC, YRC, color=color)[
0
]
XRTR1 = XDTR1 + etape * (XATR1 - XDTR1) / (nbEtapes +
1
)
YRTR1 = YDTR1 + etape * (YATR1 - YDTR1) / (nbEtapes +
1
)
CRTR1 = CDTR1 + etape * (CATR1 - CDTR1) / (nbEtapes +
1
)
color = (CRTR1[
0
], CRTR1[
1
], CRTR1[
2
])
fillTR1 = ax.fill(XRTR1, YRTR1, color=color)[
0
]
XRTR2 = XDTR2 + etape * (XATR2 - XDTR2) / (nbEtapes +
1
)
YRTR2 = YDTR2 + etape * (YATR2 - YDTR2) / (nbEtapes +
1
)
CRTR2 = CDTR2 + etape * (CATR2 - CDTR2) / (nbEtapes +
1
)
color = (CRTR2[
0
], CRTR2[
1
], CRTR2[
2
])
fillTR2 = ax.fill(XRTR2, YRTR2, color=color)[
0
]
XRTO1 = XDTO1 + etape * (XATO1 - XDTO1) / (nbEtapes +
1
)
YRTO1 = YDTO1 + etape * (YATO1 - YDTO1) / (nbEtapes +
1
)
CRTO1 = CDTO1 + etape * (CATO1 - CDTO1) / (nbEtapes +
1
)
color = (CRTO1[
0
], CRTO1[
1
], CRTO1[
2
])
fillTO1 = ax.fill(XRTO1, YRTO1, color=color)[
0
]
XRTO2 = XDTO2 + etape * (XATO2 - XDTO2) / (nbEtapes +
1
)
YRTO2 = YDTO2 + etape * (YATO2 - YDTO2) / (nbEtapes +
1
)
CRTO2 = CDTO2 + etape * (CATO2 - CDTO2) / (nbEtapes +
1
)
color = (CRTO2[
0
], CRTO2[
1
], CRTO2[
2
])
fillTO2 = ax.fill(XRTO2, YRTO2, color=color)[
0
]
XRTJ2 = XDTJ2 + etape * (XATJ2 - XDTJ2) / (nbEtapes +
1
)
YRTJ2 = YDTJ2 + etape * (YATJ2 - YDTJ2) / (nbEtapes +
1
)
CRTJ2 = CDTJ2 + etape * (CATJ2 - CDTJ2) / (nbEtapes +
1
)
color = (CRTJ2[
0
], CRTJ2[
1
], CRTJ2[
2
])
fillTJ2 = ax.fill(XRTJ2, YRTJ2, color=color)[
0
]
XRTJ1 = XDTJ1 + etape * (XATJ1 - XDTJ1) / (nbEtapes +
1
)
YRTJ1 = YDTJ1 + etape * (YATJ1 - YDTJ1) / (nbEtapes +
1
)
CRTJ1 = CDTJ1 + etape * (CATJ1 - CDTJ1) / (nbEtapes +
1
)
color = (CRTJ1[
0
], CRTJ1[
1
], CRTJ1[
2
])
fillTJ1 = ax.fill(XRTJ1, YRTJ1, color=color)[
0
]
artists.append([fillTO1, fillTO2, fillTR1, fillTR2, fillTJ1, fillTJ2, fillC])
anim = ArtistAnimation(fig, artists, repeat=
False
, interval=
100
)
for
i
in
range (
20
):
artists.append([ax.fill(XAC, YAC, c = CAC)[
0
],ax.fill(XATR1, YATR1, c = CATR1)[
0
], ax.fill(XATR2, YATR2, c = CATR2)[
0
], ax.fill(XATO1, YATO1, c = CATO1)[
0
], ax.fill(XATO2, YATO2, c = CATO2)[
0
], ax.fill(XATJ1, YATJ1, c = CATJ1)[
0
], ax.fill(XATJ2, YATJ2, c = CATJ2)[
0
]])
#fig.show()
from
matplotlib.animation
import
PillowWriter
anim.save(
"ArtistAnimation.gif"
, writer=PillowWriter(fps=
10
))
Le Hackathon, concept issu du monde de l’informatique, a encore une fois montré toute la force de l’intelligence collective à stimuler l’émergence de solutions innovantes .
Les organisateurs souhaitent exprimer leur gratitude l’égard des partenaires de l’évènement, comme, le cabinet d’expertise comptable FITECO qui a financé la réalisation des sweat-shirts, mais aussi l’APEL (Association des Parents d’Élèves de l’établissement) de l’établissement qui a généreusement offert un ultime moment convivial autour d’un repas de clôture réalisé par le Food Truck du restaurant « La Petite Fouée » d’Amboise et enfin l’entreprise de développement informatique DARVA qui a offert de multiples goodies aux participants.
Les parents, invités à la présentation des chefs-d’œuvre réalisés par les équipes, dimanche matin à 10h, ont été extrêmement nombreux. Ils ont ensuite participé au jury qui décerna les différents prix ainsi qu’au repas de clôture. Les résultats et les réalisations sont disponibles sur hackathon-ndlr.fr .
Le lycée Notre-Dame la Riche exprime sa gratitude envers tous les participants, les enseignants, les parents bénévoles et les sponsors pour avoir fait de cette première édition du Hackathon un évènement inoubliable. Grâce à leur engagement, cette expérience a été enrichissante à la fois sur le plan pédagogique et humain.
L’ensemble des participants : élèves, enseignants et parents espèrent que cette initiative marquera le début d’une tradition, et que d’autres éditions du Hackathon auront lieu à l’avenir, avec, pourquoi pas, la participation d’autres lycées.
Pour plus d’informations sur le Hackathon, veuillez contacter Isaac Aïn, enseignant en Science Informatique (NSI), référent de l’équipe d’organisation du Hackathon via le site hackathon-ndlr.fr