Open muhchaudhary opened 1 month ago
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
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
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)
)
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")
yes I tried with something similar, not working, need more investigation by others...
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?