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

Generalized animations #68

Merged
merged 3 commits into from
Sep 12, 2024
Merged

Generalized animations #68

merged 3 commits into from
Sep 12, 2024

Conversation

smikhalevski
Copy link
Owner

@smikhalevski smikhalevski commented Sep 11, 2024

Animations were generalized through the Animation interface and the runAnimation helper function:

import { useKeyboardAnimation, runAnimation } from '@racehorse/react';

useKeyboardAnimation((animation, signal) => {
  // Run the animation in sync with the native keyboard animation.
  runAnimation(
    animation,
    {
      onProgress(animation, fraction, percent) {
        const keyboardHeight = animation.startValue + (animation.endValue - animation.startValue) * fraction;

        document.body.style.paddingBottom = keyboardHeight + 'px';
      }
    },
    signal
  );
});

@smikhalevski smikhalevski force-pushed the animations branch 6 times, most recently from 4f60bf0 to abb67c0 Compare September 12, 2024 11:38
@smikhalevski smikhalevski changed the title Animations Generalized animations Sep 12, 2024
@smikhalevski smikhalevski merged commit ea29dce into master Sep 12, 2024
2 checks passed
@smikhalevski smikhalevski deleted the animations branch September 12, 2024 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant