Last active
June 13, 2022 23:54
-
-
Save ozjimbob/8a86140b5a1998e28655eec45b821502 to your computer and use it in GitHub Desktop.
Raindrops
This file contains hidden or 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
library(tickle) | |
x11(type = 'dbcairo', antialias = 'none') | |
dev.control(displaylist = 'inhibit') | |
df = data.frame(x=runif(10,-1,1),y=runif(10,-1,1),size=rep(1,10)) | |
size <- reactive_dbl(value=6) | |
rate <- reactive_dbl(value=10) | |
draw <- function() { | |
df <<- tail(df,1000) | |
df2 <- data.frame(x=runif(rate(),-1,1),y=runif(rate(),-1,1),size=rep(size(),rate())) | |
df <<- rbind(df,df2) | |
df$size <<- df$size * 0.9 | |
dev.hold() | |
plot(df$y,df$x,cex=df$size,xlim=c(-1,1),ylim=c(-1,1)) | |
dev.flush() | |
} | |
ui_spec <- tic_window( | |
idle_func = draw, idle_fps = 10, | |
tic_col( | |
tic_label("Raindrops", style = 'h3'), | |
tic_separator(), | |
tic_row( | |
tic_label("Thickness"), | |
tic_slider(variable = size, from = 6, to = 20), | |
tic_label("Rate"), | |
tic_slider(variable = rate, from = 1, to = 40) | |
) | |
) | |
) | |
win <- render_ui(ui_spec) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment