Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Animation cannot be stopped #224 #226

Merged
merged 2 commits into from
Dec 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions huemagic/hue-magic.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,14 @@ module.exports = function(RED)
{
// Node-RED < 1.0
send = send || function() { scope.send.apply(scope,arguments); }

if(typeof msg.payload.steps != 'undefined') {
scope.steps = msg.payload.steps;
//we animate if we receive steps from the input.
msg.payload.animate = true;
}

if(scope.steps != null||typeof msg.payload.steps != 'undefined')
if(scope.steps != null)
{
// SPECIALS CONFIG
if(typeof msg.payload.specials != 'undefined')
Expand All @@ -201,11 +207,11 @@ module.exports = function(RED)
}

// TURN ON ANIMATION
if(typeof msg.payload.animate == 'undefined'||msg.payload.animate == true||msg.payload === true)
if(msg.payload.animate == true||msg.payload === true)
{
var animationSteps = typeof scope.steps === 'string' ? JSON.parse(scope.steps) : scope.steps;
if(scope.isAnimating == false)
{
var animationSteps = (typeof msg.payload.steps != 'undefined') ? msg.payload.steps : JSON.parse(scope.steps);
scope.status({fill: "green", shape: "dot", text: "hue-magic.node.animating"});

scope.isAnimating = true;
Expand Down