Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Generative Art Hands On with F#

3 615 vues

Publié le

Slides from hands on Generative Art with F# session for the F#unctional Londoners meetup group at Skills Matter

Publié dans : Technologie, Art & Photos
  • Soyez le premier à commenter

Generative Art Hands On with F#

  1. 1. Generative Art Phillip Trelford F#unctional Londoners 2013
  2. 2. Generative Art: Que? Generative artists are chaos artists …embrace the chaos & learn to love it
  3. 3. Modern Art: Procedurally Generated
  4. 4. Modern Art: Animated
  5. 5. Animated Gifs
  6. 6. 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 "rn" print "A HAPPY ENDING"
  7. 7. Choose your own adventure
  8. 8. 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)
  9. 9. Deviant Art: Bubbles
  10. 10. Rothko / Async Rectangles let rec waiting() = async { let! md = Async.AwaitObservable(main.MouseLeftButtonDown) let rc = new Canvas(Background = transparentGray) main.Children.Add(rc) do! drawing(rc, md.GetPosition(main)) } and drawing(rc:Canvas, pos) = async { let! evt = Async.AwaitObservable(main.MouseLeftButtonUp, main.MouseMove) match evt with | Choice1Of2(up) -> rc.Background <- SolidColorBrush(colorSelect.CurrentColor) do! waiting() | Choice2Of2(move) -> moveControl rc pos (move.GetPosition(main)) do! drawing(rc, pos) }
  11. 11. Mandelbrot let (|Escaped|DidNotEscape|) (cx,cy) = let rec compute (zx,zy) i = if i = maxIteration then DidNotEscape elif zx * zx + zy * zy > 4.0 then Escaped i else compute (zx*zx - zy*zy + cx, 2.0*zx * zy + cy) (i+1) compute (cx,cy) 0
  12. 12. 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
  13. 13. Inspirational Sites This is Colossal Deviant Art Zen Bullets
  14. 14. F# Libraries http://smallsharp.codeplex.com (Graphics) http://funscript.info (F# -> JS) http://www.pinksquirrellabs.com (CYAO Type Provider)

×