-
Notifications
You must be signed in to change notification settings - Fork 9
Description
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 (t
ranslation and r
otation 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