Kosmisk Floræ

Generative Art

Generative aRt
R
Author

Christian Knudsen

Published

April 14, 2024

Or:

library(tidyverse)

Based on the butterfly curve

calc <- function(theta){
  exp(sin(theta)) - 2*cos(4*theta) + sin((2*theta - pi ) /24)^5
}

Prepping data for plot:

A <- seq(0,12*pi, 0.1)
r <-  calc(A)
B <- seq(0,12*pi, 2.1*pi)
C <- lapply(B, function(x) A - x) %>%  unlist()

The last two lines basically rotates the curve

Plot:

tibble(theta = C, r = rep(r, times = length(C)/length(r))) %>% 
    ggplot(aes(x=theta, y = r, color = r, alpha = 0.0001)) +
  geom_point() +
  coord_polar() +
  theme_void()+
  theme(legend.position = "none",
        plot.background = element_rect(fill = "black")) +
  scale_color_gradientn(colours  = c("red", "blue", "green")) 
  ggsave("Kosmisk_Floræ-1.png")