Hello guys,
I am trying to animate a line into a heartbeat (the line that we see on the patient’s monitor in hospitals) but I am having a hard time with it. My question here is how should I animate such thing in the LineRenderer… I saw a lot of answers in the forum section but none of them helped me/solved my question.
I also made an algorithm that I give some points,and then from point a to point b I divide this line into more points (so that the animation would be more smooth…?) and then I had the idea to just change the Y points so that it has a fake animation, but nothing…
You can definitely do it by manually positioning all of the points every single frame to animate it, but does this really need to be a LineRenderer in the first place?
i’ve used this to draw lots of fast points on line (like ECG)
https://github.com/Tayx94/graphy
but probably easier with
asset store has several suitable plugins too.
Would it be any easier with something else? Apart from some sprites (in which case he wouldn’t have much control over it), the parametric approach will always be somewhat complicated.
I would have gone for some sinusoid, but it wouldn’t look perfect.
I found this PDF about ECG simulation :
http://azadproject.ir/wp-content/uploads/2014/04/ECG.pdf
It’s not that easy, it’s using fourier series.
If you want it to “move” like a real electro-cardiogram, you’ll need either to push/pop the values or rewrite the whole array every frame / writing (nothing forces you to update it every frames)