MCPcopy Create free account
hub / github.com/NativeScript/NativeScript / animateWithSpring

Function animateWithSpring

packages/core/utils/native-helper.ios.ts:338–355  ·  view source on GitHub ↗
(options?: { tension?: number; friction?: number; mass?: number; delay?: number; velocity?: number; animateOptions?: UIViewAnimationOptions; animations?: () => void; completion?: (finished?: boolean) => void })

Source from the content-addressed store, hash-verified

336}
337
338function animateWithSpring(options?: { tension?: number; friction?: number; mass?: number; delay?: number; velocity?: number; animateOptions?: UIViewAnimationOptions; animations?: () => void; completion?: (finished?: boolean) => void }) {
339 // for convenience, default spring settings are provided
340 const opt = {
341 ...CORE_ANIMATION_DEFAULTS.spring,
342 delay: 0,
343 animateOptions: null,
344 animations: null,
345 completion: null,
346 ...(options || {}),
347 };
348 const { duration, damping } = getDurationWithDampingFromSpring(opt);
349
350 if (duration === 0) {
351 UIView.animateWithDurationAnimationsCompletion(0, opt.animations, opt.completion);
352 return;
353 }
354 UIView.animateWithDurationDelayUsingSpringWithDampingInitialSpringVelocityOptionsAnimationsCompletion(duration, opt.delay, damping, opt.velocity, opt.animateOptions, opt.animations, opt.completion);
355}
356
357// these don't exist on iOS. Stub them to empty functions.
358export const ad = platformCheck('Utils.ad');

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected