question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Listen to layer (object) position

See original GitHub issue

Is there any way to listen to an object position that is part of the lottie animation? I can change its position by applying a value callback to its keypath. What I need is to listen to its position without modifying it.

If not, will you handle it in future releases?

I tried to use LottieValueCallback to get the position:

lottieAnimationView.addValueCallback(
                    new KeyPath("Gift Outlines"),
                    LottieProperty.TRANSFORM_POSITION,
                    new LottieValueCallback<PointF>(){
                        @Override
                        public PointF getValue(LottieFrameInfo<PointF> frameInfo) {
                            return super.getValue(frameInfo);
                        }
                    }
            );

The problem is that super.getValue(frameInfo) always returns null. I assumed super.getValue(frameInfo) return the position of the “Gift Outlines” at the current call and it will be called each time “Gift Outlines” moves . I need t to listen to “Gift Outlines” position.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
silviugeorgian77commented, Sep 24, 2018

This doesn’t resolve anything.

You don’t understand the problem. Please read again what @islamassi wrote. At the moment, the so called LottieValueCallback is more of a dynamic getter than a callback. Lottie uses this getter in order to change the animated values for each frame.

We need a callback with the animated value without changing the value returned by the getter. For this, we need to use the hacks I wrote above.

If we return null in the getter, we just lose the animation. Nothing will happen.

1reaction
gpealcommented, Sep 21, 2018

Thanks for the investigation. I’ll try to look in to this further for a future release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

object-position - CSS: Cascading Style Sheets - MDN Web Docs
The object-position CSS property specifies the alignment of the selected replaced element's contents within the element's box.
Read more >
Get Layer Transform XY Top Left Coordinate Position
Here is a screen capture to show the difference between the layer top left coordinate and the transform X Y position (which match...
Read more >
LayerList | API Reference | ArcGIS API for JavaScript 4.25
The LayerList widget provides a way to display a list of layers, and switch on/off their visibility. The ListItem API provides access to...
Read more >
Sorting Layers and Sorting Order Explained (Unity 2D)
Let's learn all about how 2D Sorting works with Sorting Layers and Sorting Order. Get the Complete Builder-Defender Course!
Read more >
Position from Scale in After Effects: Free Video Tutorial & Guide
Parent the rest of the layers to the Null by dragging the swirl symbol from any ... So the position from scale expression...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found