Ticket #21: Case03.hs

File Case03.hs, 0.7 kB (added by ksf, 6 years ago)
Line 
1module Main where 
2
3import FRP.Reactive
4import FRP.Reactive.GLUT.Adapter
5import FRP.Reactive.FieldTrip.Adapter
6import Graphics.FieldTrip
7
8timeAtFramePass :: UI -> Event TimeT
9timeAtFramePass = withTimeE_ . framePass
10
11deltaFrameTime :: UI -> Event TimeT
12deltaFrameTime = fmap (uncurry (-)) . withPrevE . timeAtFramePass
13
14timeString :: UI -> Behaviour String
15timeString = stepper "" . ((fmap.fmap) show deltaFrameTime)
16
17timeText :: Anim3 -- UI -> Behaviour Geometry3
18timeText = (fmap.fmap) (flatG . utext) timeString
19
20uscale ::  Float -> Geometry3 -> Geometry3
21uscale s = (uscale3 s *%)
22
23timeDisplay :: Anim3
24timeDisplay = (fmap.fmap) (uscale 0.2) timeText
25
26main = anim3 timeDisplay