Skip to content

Instantly share code, notes, and snippets.

@djnavarro
Created March 17, 2020 06:18
Show Gist options
  • Save djnavarro/9cd828faa67545b36f9a59a17826e686 to your computer and use it in GitHub Desktop.
Save djnavarro/9cd828faa67545b36f9a59a17826e686 to your computer and use it in GitHub Desktop.
# https://github.com/djnavarro/jasmines
library(jasmines)
library(dplyr)
simple_plot <- function(octaves) {
dat <- use_seed(259) %>%
scene_rows(
n = 5,
grain = 200
) %>%
mutate(ind = 1:n()) %>%
unfold_breeze(
iterations = 100,
scale = .001,
drift = 0,
fractal = ambient::billow,
octaves = octaves
) %>%
mutate(val = ind + id * 50)
dat %>%
style_ribbon(
palette = palette_adjust(
name = "imola",
prefix = NULL,
red.f = .7,
blue.f = .7,
green.f = .7
),
colour = "val",
alpha = c(.25,.02),
background = "ghostwhite",
type = "point",
size = .4
) %>%
export_image(
paste0("~/Desktop/oct", octaves, ".png")
)
}
for(i in 1:4) simple_plot(i)
@djnavarro
Copy link
Author

oct1
oct2
oct3
oct4

@nkint
Copy link

nkint commented Apr 1, 2020

Hi! I love it, but I don't know anything about R lang.
Can you explain a little bit how does it works? Which algorithm behind it?
Any pseudocode-ish description would be nice. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment