How do I handle animations taking in high-frequency live input? #1530
Unanswered
EricHasegawa
asked this question in
Q&A
Replies: 2 comments
-
Did you consider buffering the data and downsampling it to 60HZ (fps) or even less? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I can echo @javipascual comment: only add to the path data that would be visually different. Points that wouldn't modify the visual aspect of the path can be discarded. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
II'm working on an IoT product where users can record ECG's on a small device. This device connects via Bluetooth to a React native application that allows them to view past ECG's, and to watch their ECG graph appear live as they are taking them. For reference, an ECG graph looks like this:
Viewing past ECG's it works perfectly:
Skia.Path.Make())
.useEffect
in which I set up a new blank path.Despite this working really well, I'm having trouble allowing users to watch their ECG graphs as they are taking them. The high-level ask is this:
I'm not sure how to do this using React-Native-Skia without making it unusable-y "choppy". The general problem I keep running into is that
<Path>
seems to mostly work with state variables, but state variables are immutable, so setting the whole path with such high frequency doesn't really work. I have tried:ecgPath
variable that's not a state variable, then, in auseEffect
that's triggered each timeecgData.length
changes, I take the last number in the array (the one that's been added), convert it to a point, then add that to the path. This fails in that the variable gets reset at each re-render, and since the page has to re-render so often, the graph does not generate.Is there any way I can just add one line at a time to the Path without needing to re-draw the whole thing or re-set the
ecgPath
state variable? Alternatively, is there any other techniques to handle drawing this path as input comes in?p.s. I also posted this on StackOverflow here but I am more confident I can get a response here.
Beta Was this translation helpful? Give feedback.
All reactions