random colors

This commit is contained in:
nek0 2016-12-24 01:12:34 +01:00
parent 158e4ddc80
commit ee1200b597

View file

@ -118,12 +118,21 @@ update sec = do
vx <- liftIO $ randomRIO (-20, 20) vx <- liftIO $ randomRIO (-20, 20)
vy <- liftIO $ randomRIO (-20, 20) vy <- liftIO $ randomRIO (-20, 20)
life <- liftIO $ randomRIO (1, 5) 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 tempRoot <- liftIO $ G.gegl_node_new
tempOver <- liftIO $ G.gegl_node_new_child tempRoot tempOver <- liftIO $ G.gegl_node_new_child tempRoot
G.defaultOverOperation G.defaultOverOperation
tempNop <- liftIO $ G.gegl_node_new_child tempRoot $ G.Operation tempRect <- liftIO $ G.gegl_node_new_child tempRoot $ G.Operation
"gegl:nop" [] "gegl:rectangle"
liftIO $ G.gegl_node_connect_to tempNop "output" tempOver "aux" [ 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 $ "position is: " ++ show x ++ " " ++ show y
-- traceM $ "velocity is: " ++ show vx ++ " " ++ show vy -- traceM $ "velocity is: " ++ show vx ++ " " ++ show vy
putAffection $ ud putAffection $ ud
@ -138,10 +147,10 @@ update sec = do
, particleNodeGraph = M.fromList , particleNodeGraph = M.fromList
[ ("root", tempRoot) [ ("root", tempRoot)
, ("over", tempOver) , ("over", tempOver)
, ("nop" , tempNop) , ("rect" , tempRect)
] ]
, particleStackCont = tempOver , particleStackCont = tempOver
, particleDrawFlange = tempNop , particleDrawFlange = tempOver
}) : (psParts $ partsys ud) }) : (psParts $ partsys ud)
} }
} }