Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Examples/UIExplorer/js/NativeAnimationsExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,12 @@ exports.examples = [
},
},
{
title: 'Opacity without interpolation',
title: 'Opacity with delay',
render: function() {
return (
<Tester
type="timing"
config={{ duration: 1000 }}>
config={{ duration: 1000, delay: 1000 }}>
{anim => (
<Animated.View
style={[
Expand Down
1 change: 0 additions & 1 deletion Libraries/Animated/src/AnimatedImplementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ class TimingAnimation extends Animation {
type: 'frames',
frames,
toValue: this._toValue,
delay: this._delay,
iterations: this.__iterations,
};
}
Expand Down
10 changes: 0 additions & 10 deletions Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ @implementation RCTFrameAnimation
NSArray<NSNumber *> *_frames;
CGFloat _toValue;
CGFloat _fromValue;
NSTimeInterval _delay;
NSTimeInterval _animationStartTime;
NSTimeInterval _animationCurrentTime;
RCTResponseSenderBlock _callback;
Expand All @@ -46,14 +45,12 @@ - (instancetype)initWithId:(NSNumber *)animationId
{
if ((self = [super init])) {
NSNumber *toValue = [RCTConvert NSNumber:config[@"toValue"]] ?: @1;
NSTimeInterval delay = [RCTConvert double:config[@"delay"]];
NSArray<NSNumber *> *frames = [RCTConvert NSNumberArray:config[@"frames"]];

_animationId = animationId;
_toValue = toValue.floatValue;
_fromValue = valueNode.value;
_valueNode = valueNode;
_delay = delay;
_frames = [frames copy];
_callback = [callback copy];
}
Expand Down Expand Up @@ -93,16 +90,9 @@ - (void)stepAnimation
}

NSTimeInterval currentTime = CACurrentMediaTime();
NSTimeInterval stepInterval = currentTime - _animationCurrentTime;
_animationCurrentTime = currentTime;
NSTimeInterval currentDuration = _animationCurrentTime - _animationStartTime;

if (_delay > 0) {
// Decrement delay
_delay -= stepInterval;
return;
}

// Determine how many frames have passed since last update.
// Get index of frames that surround the current interval
NSUInteger startIndex = floor(currentDuration / SINGLE_FRAME_INTERVAL);
Expand Down