rnc-archive / react-native-webgl

DEPRECATED: use expo-gl – Implements WebGL for react-native
296 stars 73 forks source link

Interactive graphics with RN #59

Closed dchersey closed 4 years ago

dchersey commented 6 years ago

Possibly dumb question: (I'm new to GL):

Is there a way to capture/bind to touch events that would trigger Javascript code that would affect the GL graphics? For example, an interactive voronoi treemap rendered in GL?

Many thanks!

gre commented 6 years ago

yeah definitely possible, you can use a react-native PanResponder to capture the touch events & do logic with it.

superandrew213 commented 6 years ago

There is a good example here which @gre just published. Pretty cool 👍

gre commented 6 years ago

@superandrew213 thanks for mentioning, yeah I think that's the best example I have today regarding PanResponder vs gl-react , for the voronoi exemple, you can probably combine that responseToTouchPosition with a port of the code of http://alexbeutel.com/webgl/voronoi.html

dchersey commented 6 years ago

Thanks for the help! I'm checking out those links; great stuff!