Skip to content

Instantly share code, notes, and snippets.

@5outh
Created Jun 6, 2018
Embed
What would you like to do?
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