Taylan Posted November 15, 2020 Share Posted November 15, 2020 You know how tween starts from motionPath.start and moves to motionPath.end? I want to get that changing value during onUpdate. Even if there is no way to get that value as is maybe I can calculate it? Are there helper functions like getPositionInPath(object, path) / getPathLength(path)? Link to comment Share on other sites More sharing options...
akapowl Posted November 15, 2020 Share Posted November 15, 2020 Hey @Taylan I don't know if there is an easier way to do that, but in your onUpdate you could check on the progress of the tween and multiply it by the total-length of the path that is the basis for that scene. Is that what you're looking for? See the Pen 603eaef6394b9af4450f0699de414c6a by akapowl (@akapowl) on CodePen 1 1 Link to comment Share on other sites More sharing options...
Taylan Posted November 15, 2020 Author Share Posted November 15, 2020 @akapowl It doesn't account for easing but unless I'm mistaken I can calculate correct value that accounts for both easing + different start/end values like this: See the Pen pobGBWd by taylankasap (@taylankasap) on CodePen Thanks! 1 Link to comment Share on other sites More sharing options...
akapowl Posted November 15, 2020 Share Posted November 15, 2020 I am by no means an expert on this, but looking at the log, this seems to work pretty well. Link to comment Share on other sites More sharing options...
Solution GreenSock Posted November 15, 2020 Solution Share Posted November 15, 2020 Nah, you could just tap into the "ratio" value to do it much more efficiently: See the Pen 6b7f98ddda185f8913017077d6b58fdb?editors=0010 by GreenSock (@GreenSock) on CodePen Think of "ratio" like the eased progress. Does that help? 4 Link to comment Share on other sites More sharing options...
Taylan Posted November 15, 2020 Author Share Posted November 15, 2020 @GreenSock It helps big time Is there a documentation for ratio (and maybe other properties of this)? Link to comment Share on other sites More sharing options...
GreenSock Posted November 15, 2020 Share Posted November 15, 2020 3 minutes ago, Taylan said: @GreenSock It helps big time Is there a documentation for ratio (and maybe other properties of this)? Sure, have you poked around the docs? Everything should be there. Here's the direct link to the ratio property of Tween instances: https://greensock.com/docs/v3/GSAP/Tween/ratio Happy tweening! 1 1 Link to comment Share on other sites More sharing options...
Taylan Posted November 15, 2020 Author Share Posted November 15, 2020 17 minutes ago, GreenSock said: Sure, have you poked around the docs? Everything should be there. I did but I expected to find it on sidebar under Properties or under search results. Thanks for the link. Link to comment Share on other sites More sharing options...
GreenSock Posted November 15, 2020 Share Posted November 15, 2020 Oh, that is odd that it doesn't show in the search results. We'll look into that. Sorry about any confusion there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now