mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
@ -409,11 +409,31 @@ export const createAnimation = (animationId?: string): Animation => {
|
||||
};
|
||||
|
||||
const keyframes = (keyframeValues: AnimationKeyFrames) => {
|
||||
const different = _keyframes !== keyframeValues;
|
||||
_keyframes = keyframeValues;
|
||||
|
||||
if (different) {
|
||||
updateKeyframes(_keyframes);
|
||||
}
|
||||
|
||||
return ani;
|
||||
};
|
||||
|
||||
const updateKeyframes = (keyframeValues: AnimationKeyFrames) => {
|
||||
if (supportsWebAnimations) {
|
||||
getWebAnimations().forEach(animation => {
|
||||
if (animation.effect.setKeyframes) {
|
||||
animation.effect.setKeyframes(keyframeValues);
|
||||
} else {
|
||||
const newEffect = new KeyframeEffect(animation.effect.target, keyframeValues, animation.effect.getTiming());
|
||||
animation.effect = newEffect;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
initializeCSSAnimation();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Run all "before" animation hooks.
|
||||
*/
|
||||
@ -668,9 +688,8 @@ export const createAnimation = (animationId?: string): Animation => {
|
||||
|
||||
if (!initialized) {
|
||||
initializeAnimation();
|
||||
} else {
|
||||
update(false, true, step);
|
||||
}
|
||||
update(false, true, step);
|
||||
|
||||
return ani;
|
||||
};
|
||||
|
Reference in New Issue
Block a user