Only-IceSoul / ReanimatedPainter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reanimated Painter

Make sure you have reanimated and Painter installed

Getting started

$ yarn add reanimated-painter

Usage

import AnimatedPainter, {getAnimatedProps } from 'reanimated-painter';
import Animated, {useAnimatedProps,useAnimatedReaction } from "react-native-reanimated";

  const theta = useSharedValue(0)

  const [animatedProps,setAnimatedProps] = getAnimatedProps<any>({
      //initial props web
  },useAnimatedProps(() => {
    return {
        //rotation
      rot: toDegrees(theta.value), 
    };
  }))

   if(Platform.OS === "web" ){
     useAnimatedReaction(()=>theta.value,(v)=>{
        runOnJS(setAnimatedProps!)({rot:toDegrees(v)})
     },[])
  }

      <AnimatedPainter.Circle
        animatedProps={animatedProps}
        />

About


Languages

Language:JavaScript 100.0%