Last active
February 1, 2023 10:59
-
-
Save ArthurData/22170553bf8b4039b87e9bfc24945a9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
signs <- c( | |
"bélier", "verseau", "cancer", "capricorne", "gémeaux", "lion", | |
"poissons", "balance", "sagittaire", "scorpion", "taureau", "vierge" | |
) | |
stars <- 700 | |
small_stars <- tibble( | |
x = sample(x = 1:200 , size = stars, replace = TRUE), | |
y = sample(x = 1:200 , size = stars, replace = TRUE), | |
force = runif(stars, min = 0, max = 0.8), | |
size = runif(stars, min = 0, max = 0.26), | |
sign = sample(signs, stars, TRUE), | |
color = "#F7F7F7" | |
) | |
##### | |
color <- "#F5F522" | |
size <- 0.90 | |
belier <- tibble( | |
x = c(50, 104, 132, 137), | |
y = c(135, 104, 64, 25), | |
force = 1, | |
size = size, | |
sign = "bélier", | |
color = color | |
) | |
verseau <- tibble( | |
x = c(25, 50, 70, 50, 75, 95, 105, 125, 63, 125, 160, 160, 200), | |
y = c(50, 100, 125, 150, 190, 200, 185, 190, 175, 150, 110, 177, 175), | |
force = 1, | |
size = size, | |
sign = "verseau", | |
color = color | |
) | |
cancer <- tibble( | |
x = c(60, 88, 118, 125, 165), | |
y = c(130, 105, 75, 25, 50), | |
force = 1, | |
size = size, | |
sign = "cancer", | |
color = color | |
) | |
capricorne <- tibble( | |
x = c(50, 75, 150, 115, 175, 165, 100, 175, 195), | |
y = c(150, 100, 50, 65, 90, 150, 150, 175, 185), | |
force = 1, | |
size = size, | |
sign = "capricorne", | |
color = color | |
) | |
gemeaux <- tibble( | |
x = c(25, 69, 50, 100, 90, 40, 140,100, 150, 115, 135, 160, 180, 75, 125), | |
y = c(117, 165, 100, 150, 110, 67, 155, 50, 100, 15, 30, 66, 90, 75, 125), | |
force = 1, | |
size = size, | |
sign = "gémeaux", | |
color = color | |
) | |
lion <- tibble( | |
x = c(50, 75, 100, 90, 140, 150, 135, 125), | |
y = c(150, 125, 150, 190, 190, 145, 100, 75), | |
force = 1, | |
size = size, | |
sign = "lion", | |
color = color | |
) | |
balance <- tibble( | |
x = c(50, 75, 100, 90, 140, 150, 135, 125), | |
y = c(150, 125, 150, 190, 190, 145, 100, 75), | |
force = 1, | |
size = 0.75, | |
sign = "balance", | |
color = color | |
) | |
poissons <- tibble( | |
x = c(25, 60, 37, 80, 110, 110, 90, 90, 110, 140, 155, 150, 175, 175), | |
y = c(25, 35, 65, 110, 140, 165, 150, 60, 65, 90, 100, 125, 125, 100), | |
force = 1, | |
size = size, | |
sign = "poissons", | |
color = color | |
) | |
sagittaire <- tibble( | |
x = c(100, 100, 75, 88, 100, 50, 25, 25, 20, 15, 45, 75, 87, 87, 100, 125, 150, 175, 175, 200, 165, 180), | |
y = c(0, 25, 35, 60, 75, 50, 75, 100, 120, 150, 175, 150, 165, 135, 150, 150, 175, 200, 150, 150, 130, 120), | |
force = 1, | |
size = size, | |
sign = "sagittaire", | |
color = color | |
) | |
scorpion <- tibble( | |
x = c(25, 35 ,50, 65, 60, 75, 100, 125, 130, 120, 125, 125, 150, 130, 150), | |
y = c(75, 85 ,100, 85, 70, 50, 65, 90, 125, 145, 160, 200, 200, 175, 175), | |
force = 1, | |
size = size, | |
sign = "scorpion", | |
color = color | |
) | |
taureau <- tibble( | |
x = c(25, 75, 105, 35, 82, 135, 123, 165, 150, 175), | |
y = c(150, 140, 110, 75, 87, 100, 55, 125, 57, 100), | |
force = 1, | |
size = size, | |
sign = "taureau", | |
color = color | |
) | |
vierge <- tibble( | |
x = c(25, 25, 40, 34, 45, 60, 68, 75, 82, 72, 58, 56, 55, 58), | |
y = c(25, 50, 50, 25, 37, 35, 36, 40, 43, 46, 42, 46, 28, 32), | |
force = 1, | |
size = size, | |
sign = "vierge", | |
color = color | |
) | |
anim <- rbind( | |
small_stars, | |
belier, | |
verseau, | |
cancer, | |
capricorne, | |
gemeaux, | |
lion, | |
poissons, | |
balance, | |
sagittaire, | |
scorpion, | |
taureau, | |
vierge | |
) %>% | |
ggplot() + | |
aes(x = x, y = y, color = color, size = size) + | |
geom_point(shape = 8) + | |
scale_colour_identity() + | |
transition_filter( | |
transition_length = length(signs), | |
`bélier` = sign == "bélier", | |
`verseau` = sign == "verseau", | |
`cancer` = sign == "cancer", | |
`capricorne` = sign == "capricorne", | |
`gémeaux` = sign == "gémeaux", | |
`lion` = sign == "lion", | |
`poissons` = sign == "poissons", | |
`balance` = sign == "balance", | |
`sagittaire` = sign == "sagittaire", | |
`scorpion` = sign == "scorpion", | |
`taureau` = sign == "taureau", | |
`vierge` = sign == "vierge" | |
) + | |
labs( | |
title = "Constellation du Zodiaque", | |
subtitle = "{closest_filter}" | |
) + | |
enter_grow() + | |
exit_shrink() + | |
theme( | |
legend.position = "none", | |
plot.title = element_text(size = 25, colour = "white"), | |
plot.subtitle = element_text(size = 25, colour = "white"), | |
plot.background = element_rect(fill = "black", colour = "black"), | |
panel.background = element_rect(fill = "black"), | |
axis.text = element_text(colour = "white"), | |
panel.grid.major = element_line(linetype = "dotted", colour = "#767676"), | |
panel.grid.minor = element_blank(), | |
text = element_text(family="Lato") | |
) | |
animate( | |
plot = anim, | |
fps = 5.5, | |
width = 2000, | |
height = 1000 | |
) | |
anim_save( | |
"constellation.gif", | |
animation = anim, | |
fps = 5.5, | |
width = 2000, | |
height = 1000 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment