Programming Generative Art

@Xavier_Ho

Front-End Development   |   Data61

Programming is creative.

Demystify generative art

Demystify generative art

Schwartzburg et al., 2014

Bostock, 2018

I. Shepherding Random Numbers

II. Mutating L-Systems

III. Summary

I. Shepherding Random Numbers

II. Mutating L-Systems

III. Summary

Randomly stamp circles


            cx += random()
            cy += random()
          

Directional randomness


            cx += random() * 0.2
            cy += random() * 10
          

Shepherding random numbers


            velocity = random()
            accumulating = running_sum(velocity)
            c += velocity + accumulating
          

Hoff, 2016

More shepherding

Shepherding in 2D

Two random volecities in 2D


            c += velocity + accumulating + anotherVelocity
          

I. Shepherding Random Numbers

||

Starting points

+

random offsets

+

accumulated random offsets

I. Shepherding Random Numbers

II. Mutating L-Systems

III. Summary

String Substitutions

Prusinkiewicz & Lindenmayer, 2004

Turtle graphics

Prusinkiewicz & Lindenmayer, 2004

Draw a rectangle


            {
              start: 'F-F-F-F'
            }
          

Substitute F


            {
              start: 'F-F-F-F',
              rule: {
                F: 'FF-F+F-F-FF',
              }
            }
            //  FF-F+F-F-FF
            // -FF-F+F-F-FF
            // -FF-F+F-F-FF
            // -FF-F+F-F-FF
          

Hilbert Curve

Penrose Tiling

Mutation: Randomly replace a rule

F: 'FF-F+F-F-FF'

F: 'F--F+F-F-FF'

F: 'F--F+FFF-FF'

F: 'F--F+F-F-+F'

Dragon curve

II. Mutating L-Systems

L-Systems are recursive, substitution functions.

Changing a character can change the whole picture.

I. Shepherding Random Numbers

II. Mutating L-Systems

III. Closing

Embrace uncertainty

Treat trial and error as normal

Logics can complement creativity

Slides at spaxe.github.io/programming-generative-art

Programming Generative Art

@Xavier_Ho

Front-End Development   |   Data61