試圖用 Moti 制作一個微調器,但在減速時遇到了一些問題(只是希望它永遠旋轉(我確實喜歡它開始時很慢,但不需要)。

import { Feather } from '@expo/vector-icons'
import { MotiText } from 'moti'
import React from 'react'
import type { TextStyle } from 'react-native'
import { Colors } from '~/constants/Theme'
type Props = {
color?: TextStyle['color']
size?: number
}
export function LoadingSpinner({ color = Colors['white'], size = 15 }: Props) {
return (
<MotiText
from={{
rotate: '0deg',
}}
animate={{
rotate: '360deg',
}}
transition={{
loop: true,
repeatReverse: false,
type: 'timing',
duration: 5000,
}}
>
<Feather
name="loader"
size={size}
style={{
paddingBottom: 5,
color,
}}
/>
</MotiText>
)
}
我猜這就是type: 'timing',問題所在,但似乎我只能timing做spring
uj5u.com熱心網友回復:
您是否嘗試添加easing: Easing.linear到transition,Easing從哪里匯入react-native-reanimated?
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/473952.html
下一篇:如何圍繞給定軸旋轉bvh運動?
