Baret Posted August 20, 2020 Share Posted August 20, 2020 Hello, I'm trying to animate a random opening with a vernier caliper but I'm having a problem. On the pen code when the two zeros are aligned the x position of the vernier is equal to zero. The problem is that from time to time for a given opening greater than zero the vernier moves to the left in abutment and yet the value of the requested vernier position is greater than zero. I can't find out why and that's why I need your help. thank you. Jean-Michel See the Pen wvGzOwp by jmbaret (@jmbaret) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted August 20, 2020 Share Posted August 20, 2020 Hey Baret. Very interesting! Thanks for posting. I noticed that the values that break all follow a consistent format: they all don't have 3 decimal places. They either have 1 or two, like 133.4, 355.7, 160.25, 262.9. It seems that trailing 0s when you pass in a string cause GSAP to render the value as 0. Definitely a bug See the Pen f79bfe2904520c089bf5d7e01e849a37 by GreenSock (@GreenSock) on CodePen But in general it's probably best to use numerical values, not strings, unless you also add a unit. 1 Link to comment Share on other sites More sharing options...
Baret Posted August 20, 2020 Author Share Posted August 20, 2020 Thank you so much, I thought the value was a number. I converted the string to a number and it works. 1 Link to comment Share on other sites More sharing options...
GreenSock Posted August 20, 2020 Share Posted August 20, 2020 Interesting. I've never seen someone try to do that before. Since you passed in a string, it interpreted the padded zeros at the end as if you intended those to be the unit (like "px" would be in "20.1px"). I've added code to work around that condition in the next release which you can preview at https://assets.codepen.io/16327/gsap-latest-beta.min.js 2 Link to comment Share on other sites More sharing options...
Baret Posted August 21, 2020 Author Share Posted August 21, 2020 Merci Jack, merci ZachSaucier, en effet je fais un usage particulier de Greensock. C'est une très belle librairie que j'ai adoptée après de nombreuses recherches. C'est facile à utiliser et cela m'a permis de mettre en pratique les idées que j'avais. Voici ce sur quoi je travaille actuellement. Il s'agit d'une animation qui vous permet d'apprendre à lire avec un pied à coulisse. Avec GSAP je peux positionner avec un effet de facilité ou récupérer la position du vernier ce qui me permet de faire les calculs pour vérifier l'entrée de l'élève (pas dans le codepen). Très pratique également, la facilité avec laquelle je peux gérer le zoom sur le vernier quelle que soit sa position. See the Pen XWdNREP by jmbaret (@jmbaret) on CodePen Link to comment Share on other sites More sharing options...
ZachSaucier Posted August 21, 2020 Share Posted August 21, 2020 I'm glad it's helpful to you! Do note that we try and stick to English in these forums 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