41 lines
1.3 KiB
Haskell
41 lines
1.3 KiB
Haskell
module Dodge.Flame.Draw where
|
|
|
|
import Dodge.Data.Flame
|
|
import Geometry
|
|
import Picture
|
|
|
|
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
|
|
. 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)
|