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

independant periodic signals #8

Open
Ebmtranceboy opened this issue Jul 21, 2020 · 2 comments
Open

independant periodic signals #8

Ebmtranceboy opened this issue Jul 21, 2020 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Ebmtranceboy
Copy link

Hi,
I have an issue to create a widget with two independant periodic signals and I've created a gist to demonstrate my problem:
https://try.purescript.org/?gist=b6a4189f977795ed7dd694671b9db8a8

Initially, I've created two signals to drive the movement of my shape : one for the translation (lines 264-270) and one for the rotation (lines 272-275). Unfortunately, my shape in widget1 (lines 277-294) is only modified by rotation because the rotation signal happens sooner than the translation one. I have confirmation of this behaviour in widget2 (lines 293-313) where it is the translation that is triggered sooner, and thus is the only one to drive my shape.

I've designed a library (lines 87-260) to address this issue : it is built around the periodically function which modifies a model by creating a signal from three records : one record for updating the periodic independant signals (lines 330-336 and lines 338-341) of any type, one for the independant periods ({t: 15.0, r: 12.0} line 349) of type Number and one for the current state of the model which is a record having the labels sample and period, should the corresponding quantities have the same labels (translation and rotation here). This way, I can get the expected behaviour in widget3 (lines 343-357) where both translation and rotation are observed simultaneously.

Depending on your thought about this, I'd like to know if you can point me towards an easier way to do that. Otherwise, I'd be glad to propose my library as a contribution.

Thanks

@Ebmtranceboy
Copy link
Author

Here's a slightly updated (debugged) and improved (no more use of the pickFn function) version of the library, together with a 3-independant-part signal demo : https://try.purescript.org/?gist=419deac545741f065dad5e60276cb9fe

@ajnsit
Copy link
Member

ajnsit commented Aug 2, 2020

Thanks, the example looks very interesting! I'll take a look soon.

@ajnsit ajnsit self-assigned this Aug 2, 2020
@ajnsit ajnsit added the enhancement New feature or request label Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants