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