Pebble.Frame

Fixed-interval frame subscriptions.

Use these for games, animations, and smooth motion. atFps is a convenience wrapper around every that converts frames-per-second to milliseconds.

import Pebble.Frame as Frame

type Msg
    = Tick Frame.Frame

subscriptions _ =
    Frame.atFps 30 Tick

update msg model =
    case msg of
        Tick frame ->
            ( { model | elapsedMs = frame.elapsedMs }, Cmd.none )

For a runnable example, use the watch-demo-frame project template in the IDE.

Native Pebble C API

Types

Frame

type alias Frame =
    { dtMs : Int
    , elapsedMs : Int
    , frame : Int
    }

Information delivered with each frame.

Subscriptions

every

every : Int -> (Frame -> msg) -> Sub msg

Receive a frame message every intervalMs milliseconds.

atFps

atFps : Int -> (Frame -> msg) -> Sub msg

Receive frame messages at the requested frames per second.