You are currently viewing the Homey Apps SDK v2 documentation. New apps should use Homey Apps SDK v3 ››

Homey.LedringAnimation

const { LedringAnimation } = require('homey');

This class contains an animation that can be played on Homey's LED Ring.

Table of Contents

Constructor

new Homey.LedringAnimation(opts)

Parameters:
Name Type Description
opts Object
Name Type Description
frames Array

An array of frames. A frame is an Array of 24 objects with a r, g and b property, which are numbers between 0 and 255.

priority string

How high the animation will have on the priority stack. Can be either INFORMATIVE, FEEDBACK or CRITICAL.

transition number

Transition time (in ms) how fast to fade the information in. Defaults to 300.

duration number | Boolean

Duration (in ms) how long the animation should be shown. Defaults to false. false is required for screensavers.

options Object
Name Type Description
fps number

Frames per second

tfps number

Target frames per second (must be divisible by fps)

rpm number

Rotations per minute

Methods

register(callbackopt) → {Promise}

Register the animation. This is a shorthand method to ManagerLedring#registerAnimation.

Parameters:
Name Type Attributes Description
callback function <optional>
Name Type Description
err Error
animation LedringAnimation
Returns:
Type:
Promise

registerScreensaver(screensaverName, callbackopt) → {Promise}

Register this animation as a screensaver. This is a shorthand method to ManagerLedring#registerScreensaver.

Parameters:
Name Type Attributes Description
screensaverName String

The name of the screensaver, as defined in /app.json

callback genericCallbackFunction <optional>
Returns:
Type:
Promise

start(callbackopt) → {Promise}

Start the animation.

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:
Type:
Promise

stop(callbackopt) → {Promise}

Stop the animation.

Parameters:
Name Type Attributes Description
callback genericCallbackFunction <optional>
Returns:
Type:
Promise

unregister(callbackopt) → {Promise}

Unregister the animation. This is a shorthand method to ManagerLedring#unregisterAnimation.

Parameters:
Name Type Attributes Description
callback function <optional>
Name Type Description
err Error
animation LedringAnimation
Returns:
Type:
Promise

unregisterScreensaver(screensaverName, callbackopt) → {Promise}

Unregister this animation as a screensaver. This is a shorthand method to ManagerLedring#unregisterScreensaver.

Parameters:
Name Type Attributes Description
screensaverName String

The name of the screensaver, as defined in /app.json

callback genericCallbackFunction <optional>
Returns:
Type:
Promise

updateFrames(frames, callbackopt) → {Promise}

Update the animation frames.

Parameters:
Name Type Attributes Description
frames Array
callback genericCallbackFunction <optional>
Returns:
Type:
Promise

Events

.on('finish')

When the animation has finished (duration has been reached)

.on('start')

When the animation has started

.on('stop')

When the animation has stopped