Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by adamjamescuz · Apr 30, 2013 at 03:31 PM · animationitweencurvemaximum

Animation Curve evaluate beyond maximum

Hi,

I've added a 'custom curve' ease function to iTween which accepts an Animation Curve which can be drawn inside the inspector. It seems to be working however the effect I am trying to achieve is similar to games like Bejeweled where an object falls down to just beyond a specified position, and then smoothly moves back again to rest in the specified position. I'm aware there are ease functions such as elastic and bounce but these are too strong for the effect I am after. The issue I have is even if I draw the curve extending beyond 1 in the y axis to try and get the object to 'overshoot' the intended target position, it never does - it just follows the curve but ignores the section of curve I have going over the maximum value. I can get it to achieve the effect I want by having the finishing point on 0.9 and the overshoot on 1 but the object doesn't tween to intended target position.

Here's my custom ease function follow a Animation curve:

 private float custom(float start, float end, float value)
 {
     return Mathf.Lerp(start, end, Curve.Evaluate(value));
 }

And my curve looks like this (you can see the bit at the end where it overshoots and then rests).

Many Thanks, Adam

alt text

screen shot 2013-04-30 at 16.07.25.png (42.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
6
Best Answer

Answer by whydoidoit · Apr 30, 2013 at 03:45 PM

You can't use Lerp because that is clamped 0 to 1 so you need:

   return start + ((end - start) * Curve.Evaluate(value));
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adamjamescuz · Apr 30, 2013 at 03:49 PM 0
Share

Perfect - thanks very much.

avatar image whydoidoit · Apr 30, 2013 at 04:02 PM 0
Share

No problem :D could you tick the answer?

avatar image adamjamescuz · Apr 30, 2013 at 04:27 PM 0
Share

whoops just up-voted, answer now ticked

avatar image
2

Answer by broersma · Jan 21, 2019 at 11:04 AM

Since 2017.1 Mathf.LerpUnclamped can be used instead. It won't clamp t and linearly extrapolate whenever t is outside the range [0, 1].

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom Easing Types using Curves for Motion? 3 Answers

iTween Interrupt/Restart Animation 1 Answer

iTween - How to move an object that is currently undergoing a "tweening"? 1 Answer

Using iTween.PutOnPath 1 Answer

Create Animation in unity3d only on one axis 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges