Where to Start Generative Art?

One of the best ways to learn digital art in R is to focus on geometrical shapes that could be visualized in R. Trying and error is the most common way to get more creative in this field. I am very much interested in working with simple and understandable geometry shapes. Here another example is provided with codes:

R1 = 1; R2 = 8
angles <- seq(0,360,length=800)
x0 <- 0
y0 <- 0
x1 = y1 = c()
R <- function(theta) R1 + R2*cos(2*pi*theta/60)
x1 = x0 + R(angles[1]) * cos(angles[1] * pi / 180)
y1 = y0 + R(angles[1]) * sin(angles[1] * pi / 180)
par(mfrow=c(1,1),mar = c(0, 0, 0, 0),bg = 'white')
plot(0, bty = 'n', xaxt='n', yaxt='n',pch = '', ylab = '', xlab = '', xlim=c(-10,10), ylim=c(-10,10))
for (i in 2:length(angles)) {
  lineLength <- R(angles[i])
  x1[i] <- x0 + lineLength * cos(angles[i] * pi / 180)
  y1[i] <- y0 + lineLength * sin(angles[i] * pi / 180)
  segments(x1[i-1], y1[i-1], x1[i], y1[i], lwd=35,col=sample(1:20,1))
  #Sys.sleep(0.8)
}
mtext('Afshin Motavali', side=1, line=-2,col='red', family ='Bodoni MT Black')
mtext('@RSTUDIO_IR', side=1, line=-1,col='red', family ='Bodoni MT Black', cex=0.8)

If you use Sys.sleep(0.3) at the end of the loop, you can see how each point is plotted as a motion graph. Also, you can change the colors as you wish in each iteration. You can use color palettes, hexa-decimals, numbers, color names and more to change the colors.

Colors are one of the main pillars of every visualization. Don’t ignore it and always try to improvise the colors using trick like this one. Colors that you choose from the nature have a wonderful characteristic of being all matched together. Thanks for reading this.