Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

958 B
Raw Blame
import { useEffect, useRef } from 'react'
import { Animated, Easing, Platform } from 'react-native'

export function useWorkingRingRotation(active: boolean): Animated.AnimatedInterpolation<string> {
  const spinValue = useRef(new Animated.Value(0)).current

  useEffect(() => {
    if (active) {
      const animation = Animated.loop(
        Animated.timing(spinValue, {
          toValue: 1,
          duration: 1000,
          easing: Easing.linear,
          // Decorative loops must not hold up interaction-scheduled list rendering.
          isInteraction: false,
          // Web has no native driver; looping native-driver timing would play only once.
          useNativeDriver: Platform.OS !== 'web'
        })
      )
      animation.start()
      return () => animation.stop()
    }
    spinValue.setValue(0)
    return undefined
  }, [active, spinValue])

  return spinValue.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] })
}