random colors

This commit is contained in:
nek0 2016-12-24 01:12:34 +01:00
parent 158e4ddc80
commit ee1200b597
1 changed files with 14 additions and 5 deletions

View File

@ -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)
}
}