Skip to content

Instantly share code, notes, and snippets.

@5outh
Created June 6, 2018 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 5outh/7c47dd303f159d964360a2c1d7bbd8cd to your computer and use it in GitHub Desktop.
Save 5outh/7c47dd303f159d964360a2c1d7bbd8cd to your computer and use it in GitHub Desktop.
renderSketch :: Generate ()
renderSketch = do
fillScreenHsv linen
cairo $ setLineJoin LineJoinRound
cairo $ setLineCap LineCapRound
cairo $ setLineWidth 0.1
xScale <- sampleRVar (D.uniform 0 3)
yScale <- sampleRVar (D.uniform 0 3)
for_ [6,9..91] $ \x' -> do
points <- replicateM (1000 + round x' * 2000) $ do
y <- sampleRVar (D.uniform 10 70)
x <- (+ (sin y * yScale)) <$> sampleRVar (pareto x' (1.5*x'))
pure (V2 (y + (sin x * xScale)) x)
cairo . for_ points $ \p -> do
drawV2 0.025 p
setSourceHsv charcoal *> fill
render :: IO ()
render = mainIOWith (\opts -> opts{ optWidth = 8 * 10, optHeight = 10 * 10 }) renderSketch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment