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

Update lerp example #1

Open
positlabs opened this issue Feb 23, 2023 · 0 comments
Open

Update lerp example #1

positlabs opened this issue Feb 23, 2023 · 0 comments

Comments

@positlabs
Copy link
Collaborator

Ideally there would be a simpler way to get an interpolated value. I was using anim.progress before, but that only works for linear interpolation.

A workaround is to animate a dummy object and get the current value from there. Maybe there's a better way. Worst case, we can create some kind of utility function.

anime({
  targets: {x: 0},
  x: 1,
  easing: 'easeInOutSine',
  loop: true,
  direction: 'alternate',
  update(anim) {
    transform.setLocalPosition(vec3.lerp(startPos, endPos, anim.animations[0].currentValue))
  },
})
positlabs added a commit that referenced this issue Mar 7, 2023
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

No branches or pull requests

1 participant