module Dodge.Flame.Draw (drawFlame) where import Dodge.Flame.Size import Dodge.Data.Flame import Geometry import Picture drawFlame :: Flame -> Picture drawFlame fl = setLayer BloomLayer . setDepth 25 . uncurryV translate (_flPos fl + rotateV (fromIntegral (_flTimer fl)) (V2 1 0)) $ circleSolidCol (V4 1 1 1 0.5) (V4 5 2 0 2) . flameSize $ fl --drawFlame :: Flame -> Picture --drawFlame pt = -- fold -- [ glow -- , aPic BloomNoZWrite prot2 25 (V2 (scaleChange + 1) 2) $ V4 2 (-1) (-1) 0.5 -- , aPic BloomNoZWrite prot 22 (V2 (scaleChange + 0.5) 1) $ V4 1 0.5 0 2 -- , aPic BloomLayer prot3 20 (V2 scaleChange 0.5) $ V4 1 1 1 1 -- ] -- where -- rotd = _flOriginalVel pt -- rotate direction -- ep = _flPos pt -- aPic :: Layer -> (Point2 -> Point2) -> Float -> Point2 -> Color -> Picture -- aPic lay offset depth (V2 scalex scaley) col = -- setLayer lay -- . setDepth depth -- . uncurryV translate (offset ep) -- . rotate (pi * 0.5 + argV rotd) -- . scale scalex scaley ---- . scale scalex scalex -- . color col -- $ circleSolid 5 -- glow = -- setLayer BloomNoZWrite $ -- setDepth 0.3 $ -- uncurryV translate ep $ -- circleSolidCol (withAlpha 0 orange) (withAlpha 0.02 orange) 50 -- time = _flTimer pt -- scaleChange -- | time < 80 = 3 -- | otherwise = 3 - (fromIntegral time - 80) * 0.2 -- prot p' = p' +.+ rotateV (fromIntegral time) (V2 0 1) -- prot2 p' = p' +.+ rotateV (negate $ fromIntegral time) (V2 0 1) -- prot3 p' = p' +.+ rotateV (2 + fromIntegral time * 0.1) (V2 0 2)