
R
kagayaku <-
function(n = 10, prob_eye = .3){
bubble_col <-
round(runif(3, 0, 255)) %>%
as.hexmode() %>%
str_c(collapse = "") %>%
paste0("#", .)
eye_col <-
round(runif(3, 0, 255)) %>%
as.hexmode() %>%
str_c(collapse = "") %>%
paste0("#", .)
x <- cos(seq_len(n) * 2 / pi)/10 + rnorm(n, 0, .01)
y <- sin(seq_len(n) * 2 / pi)/10 + rnorm(n, 0, .01)
bubble_xy <- tibble(x, y)
bubble_size <- 35 + rnorm(n, 0, 5)
add_eyes <- sample(c(NA_real_, 1), size = n, replace = TRUE, prob = c(1-prob_eye, prob_eye))
inochi <-
bubble_xy %>%
mutate(eye_x = x + rnorm(n, 0, .007) * add_eyes,
eye_y = y + rnorm(n, 0, .007) * add_eyes) %>%
ggplot(aes(x, y)) +
theme_void() +
geom_point(size = bubble_size, col = bubble_col) +
geom_point(aes(eye_x, eye_y), size = 15, shape = 21, fill = "white", col = bubble_col) +
geom_point(aes(eye_x, eye_y), size = 5, col = eye_col) +
lims(x = c(-.2, .2), y = c(-.15, .15))
suppressWarnings(plot(inochi))
}
kagayaku()