performance drawing/painting using skia #1989
Replies: 3 comments 4 replies
-
I wanted to achieve something similar today and managed to get to a smooth experience by using Reanimated. Basically the part about using the state to render the already drawn paths work fine, we just need a solution to animate the currently drawn path which has to be an animated prop using useDerivedValue and Reanimated's gesture API. My implementation (not perfect but at least working, hope it helps):
|
Beta Was this translation helpful? Give feedback.
-
Hola hola, For PencilBible we:
Having these two separate components makes it pretty performant before you get to 1k+ Annotations on a single page. Some folks Annotate a lot in PB as they draw, highlight, and take notes. |
Beta Was this translation helpful? Give feedback.
-
I've tried to implement a drawing component using skia, but failed so far to get a decent experience for this use case using react-native-skia
Most examples of drawing/painting use useState to store the paths, and then use the declarative API to draw onto Canvas. after a couple of paths it get's really slow.
There's one repo drawing-board which uses both the declarative and imperative APIs. It uses a SkiaView to get the reference of the canvas and drawPath on touches, when finished sets the path in state and uses to draw the completed paths. This crashes on iOS.. so no good, wasn't able to debug it.
Can react-native-skia be used for this use case? 60fps drawing app?
Beta Was this translation helpful? Give feedback.
All reactions