Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duration of fading transition #6174

Merged
merged 8 commits into from
Jul 8, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class FadingTransition
const delayFunction = this.getDelayFunction();
const callback = this.callbackV;
const delay = this.getDelay();
const duration = (this.durationV ?? 500) / 2;
const halfDuration = (this.durationV ?? 500) / 2;

return (values) => {
'worklet';
Expand All @@ -45,24 +45,24 @@ export class FadingTransition
opacity: delayFunction(
delay,
withSequence(
withTiming(0, { duration }),
withTiming(1, { duration })
withTiming(0, { duration: halfDuration }),
withTiming(1, { duration: halfDuration })
)
),
originX: withDelay(
delay + duration,
delay + halfDuration,
withTiming(values.targetOriginX, { duration: 0 })
),
originY: withDelay(
delay + duration,
delay + halfDuration,
withTiming(values.targetOriginY, { duration: 0 })
),
width: withDelay(
delay + duration,
delay + halfDuration,
withTiming(values.targetWidth, { duration: 0 })
),
height: withDelay(
delay + duration,
delay + halfDuration,
withTiming(values.targetHeight, { duration: 0 })
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export class JumpingTransition
const delayFunction = this.getDelayFunction();
const callback = this.callbackV;
const delay = this.getDelay();
const duration = (this.durationV ?? 300) / 2;
const config = { duration: duration * 2 };
const duration = this.durationV ?? 300;
const halfDuration = duration / 2;
const config = { duration };

return (values) => {
'worklet';
Expand All @@ -57,13 +58,13 @@ export class JumpingTransition
withTiming(
Math.min(values.targetOriginY, values.currentOriginY) - d,
{
duration,
duration: halfDuration,
easing: Easing.out(Easing.exp),
}
),
withTiming(values.targetOriginY, {
...config,
duration,
duration: halfDuration,
easing: Easing.bounce,
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ export class SequencedTransition
const delayFunction = this.getDelayFunction();
const callback = this.callbackV;
const delay = this.getDelay();
const sequenceDuration = (this.durationV ?? 500) / 2;
const config = { duration: sequenceDuration };
const halfDuration = (this.durationV ?? 500) / 2;
const config = { duration: halfDuration };
const reverse = this.reversed;

return (values) => {
Expand Down