25
Generative Art Phillip Trelford, @ptrelford Functional Vilnius 2015, @fpvilnius

Generative Art - Functional Vilnius 2015

Embed Size (px)

Citation preview

Generative ArtPhillip Trelford, @ptrelford

Functional Vilnius 2015, @fpvilnius

F#unctional londoners

• Founded Feb 2010

• 1000+ Members

• Meets every 2 weeks

• Topics include• Machine Learning

• Finance

• Games

• Web

• Arthttp://meetup.com/fsharplondon

Generative Art: Que?

Generative artists are chaos artists

…embrace the chaos & learn to love it

Generative Art: Functional?

• Functional Geometry Paper

• Peter Henderson, 1984

http://pmh-systems.co.uk/phAcademic/papers/funcgeo.pdf

Procedural Art

Phillip Trelford, @ptrelford

Functional Vilnius 2015, @fpvilnius

Mondrian: Procedurally Generated

http://www.clear-lines.com/blog/post/Transform-a-picture-in-the-style-of-Mondrian-with-FSharp.aspx

Lohse re-animated

http://trelford.com/blog/post/Lohse.aspx

Loewensburg Reanimated

http://trelford.com/blog/post/Loewensberg.aspx

Loewensburg Palette

Animated Gifs

ASCII Art

Phillip Trelford, @ptrelford

Functional Vilnius 2015, @fpvilnius

Happy endings

// Generate text from Philippe Decrauzat's D.T.A.B.T.W.H.A.H.E. 2010

let print (s:string) =

[|for y in 0..s.Length-1 ->

[|for x in 0..y-1 -> s.[x]

for x in y..s.Length-1 -> s.[y]

|]

|> fun cs ->

System.String(cs) +

System.String(cs |> Array.rev |> Seq.skip 1 |> Seq.toArray)

|]

|> fun ys -> [|yield! ys; yield! (Array.rev ys |> Seq.skip 1)|]

|> String.concat "\r\n"

print "A HAPPY ENDING"

http://fssnip.net/ii

@FsiBot

http://trelford.com/blog/post/fsibot.aspx

Emoji Art

http://nf2p.com/f-sharp/generating-emoji-art-using-f-sharp/

Choose your own adventure

http://www.pinksquirrellabs.com/post/2013/07/29/Choose-Your-Own-Adventure-Type-Provider.aspx

Shapes

Phillip Trelford, @ptrelford

Functional Vilnius 2015, @fpvilnius

SmallSharp: Lines

open Library

do GraphicsWindow.Show()

GraphicsWindow.BrushColor <- red

for i in 0..5..200 do

GraphicsWindow.DrawLine(i,0,n-i,n)

GraphicsWindow.DrawLine(0,i,n,n-i)

Deviant Art: Bubbles

Louvre: Abu Dhabi

http://fsharp.org/testimonials/#goswin-1

Embracing Randomness

Phillip Trelford, @ptrelford

Functional Vilnius 2015, @fpvilnius

Turing Drawings

match action with

| Action.Left ->

xPos <- xPos + 1

if xPos >= mapWidth then xPos <- xPos - mapWidth

| Action.Right ->

xPos <- xPos - 1

if (xPos < 0) then xPos <- xPos + mapWidth

| Action.Up ->

yPos <- yPos - 1

if (yPos < 0) then yPos <- yPos + mapHeight

| Action.Down ->

yPos <- yPos + 1

if yPos >= mapHeight then yPos <- yPos - mapHeight

http://trelford.com/blog/post/Turing.aspx

Random Art

http://trelford.com/blog/post/rand.aspx

Random Art animated

Inspirational Sites

This is Colossal Deviant Art Zen Bullets

Resources

http://smallsharp.codeplex.com (Windows only Graphics)

http://funsharp.github.com (Cross Platform Graphics)

http://funscript.info (F# -> JS)

http://www.pinksquirrellabs.com (CYOA Type Provider)

http://c4fsharp.net/#fsharp-coding-dojos (Dojos)