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

Skew tweening fix #124

Merged
merged 2 commits into from
Aug 11, 2022
Merged

Skew tweening fix #124

merged 2 commits into from
Aug 11, 2022

Conversation

ericente
Copy link
Collaborator

Makes skew tweening always go the short way. Previously a skew tween from 180° to -170° would traverse 350° when the default behavior in Animate would be a tween of 10°.

@ericente ericente requested a review from andrewstart August 11, 2022 22:37
@ericente
Copy link
Collaborator Author

Just realized I could probably written this as:

function lerpSkew(start: number, end: number, t: number): number
{
    let value = lerpRotation(start, end, t);
    if (value > PI) return value - TWO_PI;
    if (value < -PI) return value + TWO_PI;

    return value;
}

Not sure if you have a preference...

@andrewstart
Copy link
Collaborator

This works, as we could change rotation lerping in the future without messing up skew.

@andrewstart andrewstart merged commit c689681 into master Aug 11, 2022
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.

2 participants