Skip to content

Commit

Permalink
Remove prevPosition in SpringState (software-mansion#386)
Browse files Browse the repository at this point in the history
Creates a type name that is non-specific to one animation function. This is useful when an animation state is shared between animation functions (spring + decay for instance).
  • Loading branch information
wcandillon authored and kmagiera committed Sep 21, 2019
1 parent 453d7e4 commit c3c0d71
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions react-native-reanimated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,18 @@ declare module 'react-native-reanimated' {
...others: Adaptable<number>[]
) => AnimatedNode<T>;

export interface DecayState {
export interface AnimationState {
finished: AnimatedValue<number>;
velocity: AnimatedValue<number>;
position: AnimatedValue<number>;
time: AnimatedValue<number>;
}

export interface PhysicsAnimationState extends AnimationState {
velocity: AnimatedValue<number>;
}

export type DecayState = PhysicsAnimationState;

export interface DecayConfig {
deceleration: Adaptable<number>;
}
Expand All @@ -85,10 +91,7 @@ declare module 'react-native-reanimated' {
stop: () => void;
}

export interface TimingState {
finished: AnimatedValue<number>;
position: AnimatedValue<number>;
time: AnimatedValue<number>;
export interface TimingState extends AnimationState {
frameTime: AnimatedValue<number>;
}
export type EasingFunction = (value: Adaptable<number>) => AnimatedNode<number>;
Expand All @@ -98,13 +101,8 @@ declare module 'react-native-reanimated' {
easing: EasingFunction;
}

export interface SpringState {
finished: AnimatedValue<number>;
velocity: AnimatedValue<number>;
position: AnimatedValue<number>;
prevPosition?: AnimatedValue<number>;
time: AnimatedValue<number>;
}
export type SpringState = PhysicsAnimationState;

export interface SpringConfig {
damping: Adaptable<number>;
mass: Adaptable<number>;
Expand Down

0 comments on commit c3c0d71

Please sign in to comment.