From ee1200b597281938c007dc9453746780d2af7b6d Mon Sep 17 00:00:00 2001 From: nek0 Date: Sat, 24 Dec 2016 01:12:34 +0100 Subject: [PATCH] random colors --- examples/example03.hs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/example03.hs b/examples/example03.hs index 3d296b4..da2ed00 100644 --- a/examples/example03.hs +++ b/examples/example03.hs @@ -118,12 +118,21 @@ update sec = do vx <- liftIO $ randomRIO (-20, 20) vy <- liftIO $ randomRIO (-20, 20) life <- liftIO $ randomRIO (1, 5) + r <- liftIO $ randomRIO (0,1) + g <- liftIO $ randomRIO (0,1) + b <- liftIO $ randomRIO (0,1) tempRoot <- liftIO $ G.gegl_node_new tempOver <- liftIO $ G.gegl_node_new_child tempRoot G.defaultOverOperation - tempNop <- liftIO $ G.gegl_node_new_child tempRoot $ G.Operation - "gegl:nop" [] - liftIO $ G.gegl_node_connect_to tempNop "output" tempOver "aux" + tempRect <- liftIO $ G.gegl_node_new_child tempRoot $ G.Operation + "gegl:rectangle" + [ G.Property "x" $ G.PropertyDouble $ fromIntegral x - 10 + , G.Property "y" $ G.PropertyDouble $ fromIntegral y - 10 + , G.Property "width" $ G.PropertyDouble 20 + , G.Property "height" $ G.PropertyDouble 20 + , G.Property "color" $ G.PropertyColor $ (G.RGBA r g b 0.5) + ] + liftIO $ G.gegl_node_connect_to tempRect "output" tempOver "aux" -- traceM $ "position is: " ++ show x ++ " " ++ show y -- traceM $ "velocity is: " ++ show vx ++ " " ++ show vy putAffection $ ud @@ -138,10 +147,10 @@ update sec = do , particleNodeGraph = M.fromList [ ("root", tempRoot) , ("over", tempOver) - , ("nop" , tempNop) + , ("rect" , tempRect) ] , particleStackCont = tempOver - , particleDrawFlange = tempNop + , particleDrawFlange = tempOver }) : (psParts $ partsys ud) } }