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

Make it optional to preserve old state on animation method #2

Open
Fensterbank opened this issue Jan 15, 2019 · 2 comments
Open

Make it optional to preserve old state on animation method #2

Fensterbank opened this issue Jan 15, 2019 · 2 comments

Comments

@Fensterbank
Copy link
Member

When an animation (e.g. by using a configured animationPreset or by calling the POST method directly) is started, the old state is preserved and reset at the end of the animation

  const old = dmx.universeToObject(req.params.universe);
  [...]
  animation.add(old, 0);

See https://github.com/node-dmx/dmx-web/blob/master/dmx-web.js#L89

By preserving the old state the animation API cannot be used for fading light in and out.
There should be a parameter to define if the old state should be preserved and preserving the old state should be false by default, since simple animations like

[
  {
    "to": {"1":255,"2":255,"3":255,"4":255},
    "duration":1000
  }
]

feel broken.

While it may be a breaking change, I think preserving the old state is not logical.
If the API can be used to set specific channels by using a specific duration, the user does not understand, why it goes back to the previous state after the animation is finished.

@wiedi
Copy link
Member

wiedi commented Jan 15, 2019

Sounds good.

Another way that would not be breaking could be to have a second API endpoint at /transition/<universe> for animations that don't return to the original state. But either way is fine. I don't think many consumers rely on this API and adding that parameter would also be easy.

@williamoverton
Copy link

You could try out the scene system in my PR, here is an example scene:

{
    "id": "fhfdghdfgh-1cf6-fghj-vbnm-ghjk827e01ac",
    "label": "Transition 1",
    "type": "full",
    "values": [
      {
        "type": "static",
        "transition": 5000,
        "channel": "1",
        "value": "255",
        "universe": "office"
      },
      {
        "type": "static",
        "transition": 5000,
        "channel": "3",
        "value": "255",
        "universe": "office"
      }
    ]
  }

The "transition" key lets you specify how long the fade to those values should take, it transitions form the current state of the universes smoothly without going to zero first.

There is also an API endpoint at /state/<sceneId>

Cheers,
Will

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants