menu

Popmotion

Help and discussion for Popmotion's animation libraries: Popmotion, Pose, React Pose, React Native Pose, etc

Channels
Team

Is it possible to set animated dev position via props?

June 5, 2019 at 8:04am

Is it possible to set animated dev position via props?

June 5, 2019 at 8:04am (Edited 3 months ago)

I have an animated div and I want to set its position dinamycally with props. Is there a way to do it? Can I do something like x: ({ x }) => x in config? Here is example


June 5, 2019 at 9:09am

Hey. The problem is that you're using a very very old version of react-pose. Here the working link:

  • reply
  • like

Thank you @catalinmiron, your post was really helpful! I've edited your code a bit, so that x,y is changed with setState, but div's position doesn't update.

What is the problem?

Edited
  • reply
  • like

June 6, 2019 at 2:16pm

Hi @ruslan-ishkildin, I was playing with this the other day and the trick seems to come with poseKey. I found the doc a bit sparse on the subject but is this corrected sample matches you need?

Pose trigger the transition if the component pose change but poseKey force the transition to the dynamic value even if the pose didn't change.

Edited
  • reply
  • like