Open crscheid opened 1 year ago
Clarify and Align
speed
,offset
, anddelay
parameters
I would be open to a breaking change PR to make these more intuitive and consistent 👍
Proposed
Sequence
Effect Class
I'm not sure I am a fan of implementing this. To me, it feels like it is stretching what I'd consider to be an "effect" into what is really just control functionality. The library already has the ability to run a sequence of events using TimedEvents, and one could add some custom logic around this to allow it to loop if you wanted.
Open to suggestions on improving the interface of TimedEvents though 😄
Proposed Ability to Cancel Fixture Animations
Could you provide a code sample using one of the built-in effects for where this is going wrong? The base Effect class has a cleanup method that removes the callback from the internal ticker to stop animations?
Thanks for responding.
The library already has the ability to run a sequence of events using TimedEvents
Cool, I did not see this in the library. Let me take a look at this and see I can use this aspect to meet my needs.
Could you provide a code sample using one of the built-in effects for where this is going wrong?
I took another look at the built-in effects and those effects do not utilize calls to fixtures that animate. Both Chase and and Dim track the interim values of the event and make the call to the fixture like:
self.fixture.color(color, 0)
or
self.fixture.set_channel('dimmer', int(255 * progress))
In both of these cases with the built-in effects, the call to Fixture
is done instantly and the effect manages the values over time. Contrast that with my previously mentioned Sequence
class where I am calling fixtures like this:
self.fixture.color(color,time_ms)
or
self.fixture.dim(dim_level, time_ms)
In my case I'm passing in the milliseconds
argument to the FixtureHelpers
methods which then ultimately passes that value onto the dim
method which then creates its own callback with the ticker. It is this callback that continues despite clearing the effect.
Its possible that perhaps there was never an intent to allow direct access to the FixtureHelper methods that do this in the case of effects. I just found it to be very convenient instead of tracking all of the interim values within my effect.
So in effect, if you use these calls in the FixtureHelper, it appears you loose control over those animations.
So in effect, if you use these calls in the FixtureHelper, it appears you loose control over those animations.
Ah! That makes sense, and is definitely an oversight -- I would be happy to accept a PR that implements something internal on FixtureHelper/Fixture to keep track of the current animation, and expose a method to clear it. That method should probably also be called automatically any time a new animation is started, so things don't clash.
I would be happy to accept a PR that implements something internal on FixtureHelper/Fixture to keep track of the current animation, and expose a method to clear it.
Ok cool, let me focus on that first then. Doing so will unblock progress on my end. I've got two other feature requests (#49 #50) as well so I'll try to package those in with this.
I would be happy to accept a PR that implements something internal on FixtureHelper/Fixture to keep track of the current animation, and expose a method to clear it.
@MattIPv4: I've got a branch in my fork that is ready for a PR, but I still have the outstanding PR that supports resolving #49 outstanding. Did you want to approve that PR first before me submitting another PR for this - or would you rather I package these all up at once?
My solution is to track local callbacks assigned within the FixtureHelper class and to clear them out along with effects when clear_effects()
is called on the Fixture. Seems to work well and won't affect any prior utilization of this library. Everything is self contained within Fixture()'s interface. 🤘🏼
Publishing this as more of a discussion item for @MattIPv4 to consider and perhaps comment on rather than an actual enhancement request appropriate for this library. A lot of what I've run into in my work might end up being breaking changes if actually tackled as an enhancement to this library. I'm considering branching off of this project to do some of these enhancements but before doing so wanted to outline my thinking.
Clarify and Align
speed
,offset
, anddelay
parametersI noticed that speed is in ms while offset and delay are in percentage integers (i.e. 50 = 50%). Took me a while to work out the math to figure out what was going on here. It might be helpful to those using this in precise timing applications to keep these consistent as ms.
Proposed
Sequence
Effect ClassI had the need to be able to kick off a string of animations targeted towards a group of fixtures but then also loopback to a specific step. Consider the example of a scene change that bursts the lights to full white then begins cycling a chase-like pattern through 4-5 steps.
To implement this, I created a new
Sequence
Effect class that allows one to pass in a list of Fixture operations that you'd like to perform at certain times in sequence with ability to loopback to a specific index and define the step timing. Steps are passed in a dict of tuples where the key is the ms value at which to perform the animation and the tuple contains the Fixture operation, and arguments. You can also offset by step instead of percentage, and define a loopback point in that list of steps.The following will run all lights Pink, Blue, Red, Warm, Green, then cycle Red, Warm, Green in a loop. Because
offset_index
is False, all lights are in sync. Ifoffset_index
was True, then the first light in theall_lights
list would start on pink, the second would start on Blue, the third on Red, etc.Proposed Ability to Cancel Fixture Animations
Considering in my code I now have this Sequence class that can apply animations across fixtures, if I want to enable a new Sequence, I need the ability to not only remove the Effect from the callbacks (e.g. my specific Sequence class), but also the animation calls that were attached to the fixtures. I encountered this when applying this use case:
Still considering the best way to handle this. I've had success clearing all callbacks and then adding back the
__send
callback, but it seems hackish. Still pondering and experimenting. 🤔At any rate, you can probably see that my use is running into some possible design assumptions. I'd be happy to consider thoughts and opinions on this. I would love to contribute to this project and its functionality rather than creating a Frankensteined branch.
Thanks for listening.