Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any example for lottie_animation_property_override? #11

Open
muhchaudhary opened this issue Jun 10, 2024 · 4 comments
Open

Any example for lottie_animation_property_override? #11

muhchaudhary opened this issue Jun 10, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@muhchaudhary
Copy link

Hey, sorry if this is a dumb question but I can't get the lottie_animation_property_override function to work on my end. Do you by any chance have an example I could use?

@laggykiller
Copy link
Owner

laggykiller commented Jun 10, 2024

I did not expect someone to use that function, so little thought was put into it.

Seems like I wrongly assumed that the *args are ctypes.float. They should be ctypes.double

https://github.com/Samsung/rlottie/blob/d40008707addacb636ff435236d31c694ce2b6cf/inc/rlottie_capi.h#L269-L290

https://github.com/Samsung/rlottie/blob/d40008707addacb636ff435236d31c694ce2b6cf/src/binding/c/lottieanimation_capi.cpp#L199-L286

To change fillcolor property of fill1 object in the layer1->group1->fill1 hirarchy to RED color:

lottie_animation_property_override(
    "LOTTIE_ANIMATION_PROPERTY_FILLCOLOR",
    "layer1.group1.fill1",
    ctypes.c_double(1.0),
    ctypes.c_double(0.0),
    ctypes.c_double(0.0)
)

If all the color property inside group1 needs to be changed to GREEN color:

lottie_animation_property_override(
    "LOTTIE_ANIMATION_PROPERTY_FILLCOLOR",
    "**.group1.**",
    ctypes.c_double(0.0),
    ctypes.c_double(1.0),
    ctypes.c_double(0.0)
)

Please try. If this works please tell me so I can make changes to the docs.

EDIT: Seems like it is not working and need some work, will update about this

@laggykiller
Copy link
Owner

laggykiller commented Jun 10, 2024

Please try v1.3.6, I cannot demonstrate that it works, but should be less broken. Maybe you can figure this out yourself. Unfortunately I don't have more time and interest in digging further. Please tell me if it works.

Note that the API has changed: https://rlottie-python.readthedocs.io/en/latest/rlottie_python.html#rlottie_python.rlottie_wrapper.LottieAnimation.lottie_animation_property_override

You should call like:

from rlottie_python import LottieAnimation, LottieAnimationProperty

lottie_animation_property_override(
    LottieAnimationProperty.LOTTIE_ANIMATION_PROPERTY_FILLCOLOR,
    "layer1.group1.fill1",
    ctypes.c_double(1.0),
    ctypes.c_double(0.0),
    ctypes.c_double(0.0)
)

@laggykiller laggykiller added the help wanted Extra attention is needed label Jun 10, 2024
@muhchaudhary
Copy link
Author

Sorry for the late reply, testing it with this simple lottie file, it dosn't seem to work

from rlottie_python.rlottie_wrapper import LottieAnimation, LottieAnimationProperty
import ctypes

anim = LottieAnimation.from_file("/home/muhammad/Downloads/circle.json")


anim.lottie_animation_property_override(
    LottieAnimationProperty.LOTTIE_ANIMATION_PROPERTY_FILLCOLOR,
    "Layer.Ellipse.Fill",
    ctypes.c_double(1.0),
    ctypes.c_double(0.1),
    ctypes.c_double(0.5),
)

anim.save_animation("/home/muhammad/Downloads/circle.gif")

@laggykiller
Copy link
Owner

yes I tried with something similar, not working, need more investigation by others...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants