Issues modifying the Duik's Connector Code
It is Known that Duik's Connector cycles through every keyframe that is connected to a controller. It works like using Time Remap on a Property.
I Thought that would be useful if we had an "Absolute" animation mode. That interpolates only the values between the two nearest keyframes from a controller, ignoring all the other keyframes that the connected propriety has. The example above explains a little better what am i trying to do.
That said, i started tinkering the Connector's code and found a way to do this "Absolute" animation with it:
Here's what i wrote:
Here's a link that compares the original code (left/red) and the code that i wrote (right/green):
The code kinda works as intended.
I only have three issues with it:
- I can't translate the connector's speed and easing from the connector to the to the connected properties.
Somehow the original code can do it, i believe it's because of how the linear that determines the current value was built
The thing is that i couldn't think any other way to capture and interpolate the values from both nearest keyframes.
- It Can't work natively with shape layers.
The OG code can because it is written based on the valueAtTime() function.
To avoid cycling through every frame i had base myself on the .value property instead. This is not a big deal to me, since i can work with points follow nulls or something similar.
- The code has tons of ugly and unnecessaries sintaxes.
Well, i'm not a programmer. I can't read very cleary what i'm doing with my code.
I know some of the issues listed above could be solved if i wrote the code more likely to how the original was written, but I burned out all my knowledge about expressions trying to figure out the solutions i wrote.
I can't argue about the last two issues, the easing issue could already make the code 100% usable.
With it done, we could have a powerfull LipSync/Facial expressions Rig that can jump straight to desired poses on an animation.
Thanks in advance and sorry if i did not made clear what i'm trying to do. English is not my native language...
I don't have duIK instaleld ATM, but you can see in this thread that we accomplished kind of the same thing with Joysticks n Sliders:
Let me know if that helped you in solving your challenge.
Hi Filip, you have an ellegant soution there!
I have a quesion, do your code consider the Easing from the slider? if it does, how?
what i got with my code is:
where, keyF_A is the previous pose keyframe that will be controlled by a controller, and KeyF_B is the next.
Then we have, the time whe the poses happens as time_A and time_B.
I did it! Thank you so much Filip!
I had to add
and change the last linear(); function to:
My code is a messy hell, with tons of try and catch, but at least it works.
If you have any advise to clean it up, would be welcome...
You can test it without Duik, just by pasting the entire code into a property that you want to have multiple poses
and changing the
var ctrlLayer =thisComp.layer("C | Slider 2");
var ctrlFrames = ctrlLayer.transform.xPosition
to any controller layer and property.
Thank you once again Filip