mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 09:34:19 +08:00

Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> The `AnimationController` does not use the correct underlying instance of the utilities from either the lazy or custom elements build, depending on if the developer is using `@ionic/angular` or `@ionic/angular/standalone`. It will always use the lazy instance. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - `AnimationController` uses the instance of the utilities based on it's implementation type, e.g. `@ionic/angular/standalone` uses the custom elements build with the utilities from `@ionic/core/components`. - `@ionic/angular` and `@ionic/angular/standalone` now export their own specific implementation of `AnimationController` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> Ionic was re-exporting the `AnimationController` from both `@ionic/angular` and `@ionic/angular/standalone` entry points. Developers will not need to update their implementations or change import paths to take advantage of this change. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import type { Animation } from '@ionic/core';
|
|
import { createAnimation, getTimeGivenProgression } from '@ionic/core/components';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class AnimationController {
|
|
/**
|
|
* Create a new animation
|
|
*/
|
|
create(animationId?: string): Animation {
|
|
return createAnimation(animationId);
|
|
}
|
|
|
|
/**
|
|
* EXPERIMENTAL
|
|
*
|
|
* Given a progression and a cubic bezier function,
|
|
* this utility returns the time value(s) at which the
|
|
* cubic bezier reaches the given time progression.
|
|
*
|
|
* If the cubic bezier never reaches the progression
|
|
* the result will be an empty array.
|
|
*
|
|
* This is most useful for switching between easing curves
|
|
* when doing a gesture animation (i.e. going from linear easing
|
|
* during a drag, to another easing when `progressEnd` is called)
|
|
*/
|
|
easingTime(p0: number[], p1: number[], p2: number[], p3: number[], progression: number): number[] {
|
|
return getTimeGivenProgression(p0, p1, p2, p3, progression);
|
|
}
|
|
}
|