Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

animate function should take in a callback parameter #35

Open
3 tasks done
gal-cernilogar opened this issue Feb 12, 2024 · 0 comments
Open
3 tasks done

animate function should take in a callback parameter #35

gal-cernilogar opened this issue Feb 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@gal-cernilogar
Copy link

gal-cernilogar commented Feb 12, 2024

Clear and concise description of the problem

The animate function should be able to take in a callback as described in the motionone docs.

Suggested solution

In Motion One for Vue, there was an animate.es.js file in the motion module, which contained the extended functionality of the animate function with:

import { animate as animate$1, withControls } from '@motionone/dom';
import { isFunction } from '@motionone/utils';
import { Animation } from '@motionone/animation';

function animateProgress(target, options = {}) {
    return withControls([
        () => {
            const animation = new Animation(target, [0, 1], options);
            animation.finished.catch(() => { });
            return animation;
        },
    ], options, options.duration);
}
function animate(target, keyframesOrOptions, options) {
    const factory = isFunction(target) ? animateProgress : animate$1;
    return factory(target, keyframesOrOptions, options);
}

export { animate, animateProgress };

Alternative

No response

Additional context

Without this functionality, the claim

The animate prop accepts all the same values and keyframes as Motion One's animate function.

at Oku Motion docs cannot be made as it is an important feature which prevents the transition from Motion One for Vue to Oku Motion.

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants