Joysticks in Synfig (Controller Plugin)

Hello,

I saw this plugin in After Effects called Joysticks and Sliders,

Basically, you create 5 extreme poses (normal, left, right, top, down) and the plugin will then create a controller with which you can move the head rig in any direction.

To understand, you can watch how it works.

I tried to understand, how come the plugin interpolates between two states. I worked on a script and it does what the plugin does.

The script, for now only works for origin and position. My plans are to extend its usage to do most of the interpolation (which is possible).

demo

Hereā€™s the demo file

characterdemo.sifz (39.6 KB)

The script(plugin) is not yet useful for anyone right now, but I will work on that. So you can use it.

For those who want to know how it works,
First, you keyframe the 5 poses on 5 frames.
Then you will have 5 vectors that represent the position of the group/layer.
Now according to the controller (which is an exported value and is not connected to anything).

The current position of a group/layer is calculated by adding the vectors together and scaling the vector with respect to the controller from the center of the controller box. You can just look at the origin(offset from transformations for a group) and see the nested converter.

Current Limitations:
Only works for the position (origin),
Need to manually create the exported valuenodes named ā€œcontrollerā€ and also convert the controller to composite and export the X-Axis as ā€œcontrollerXā€, and Y-Axis as ā€œcontrollerYā€.
The controller origin currently is at -300, 100. And the box of 200x200 px around the controller is also fixed. I will work on them so that we can move the controller where ever we want. I will post the script next week (only if possible, my exams are near).

If you any ideas then you can suggest me. Also ask any doubts.

18 Likes

Wooow! This is like the master controller in Toon Boom Harmony.

A little update, I just checked out it on vertex transformations and it works fine, I think it will work fine for anything that is made up of vector.

demo

Edit, now also works for tangents too.

tangent demo

I also want to know what are other primitive value nodes in Synfig,
For now, my script works for vector, real, angle.

I think I should start working on color now.

Tell me if I am missing something.

4 Likes

Can anybody explain to me how Synfig handles deleted vertices?
It creates a transition from both states but nothing is interpolating, Synfig does the transition itself.

@rodolforg @ice0 @BobSynfig
If you know, where the code for this is, will be helpful, (I will try to understand by myself)

Just a correction: value types, not value nodes :slight_smile:
I listed them here:
https://synfig-docs-dev--79.org.readthedocs.build/en/79/common/sif_file_format.html#value-elements

It isnā€™t in official synfig-docs-dev yet (PR wasnā€™t merged).

Do you mean animated vertex deletion? I think itā€™s something like on-off active points. I canā€™t recall right now, because I never dug it.

Yes,

I looked at sif file there are attributes on that vertex defining the on-off time for that vertex.

My question is when we animate a vertex deletion, Synfig creates a morph between the shape that has the vertex and the deleted vertex shape. This morph is generated automatically (I think this happens in Synfig CLI), without any control for the user. I wanted to know how the morph works so that I can somehow implement the same thing within my plugin which would then handle the deletion of vertices.

face demo

Hereā€™s another demo I have made to show usage of the plugin.

2740517.sifz (31.0 KB)

6 Likes

This is very interesting and I can compare it to an earlier post by @Khemardi about use of animation templates in synfig with details here

2 Likes

Hello every one, here is my plugin. Download the zip file and put it in the plugins directory for your operating system. Plugins ā€” Synfig User Manual 1.4.0 documentation

joystickPlugin.zip (4.1 KB)

To use the plugin,

  1. Create 5 waypoints that you want to be controlled by the joystick controller.
  2. This waypoint must be in the order Normal(Front), Right, Left, Top, Down. (this can be anything, but at least is should make sense accordingly)
  3. And run the plugin.

You must create 5 waypoints for each parameter that you want to be controlled by the controller (joystick). If less than 5 waypoints exist then the plugin will ignore that parameter. And only link the parameters which have 5 or more parameters. If more than 5 waypoints are found only the first 5 waypoints will be considered.

Also, you can offset items even after you run the plugin. You can run the plugin more than once and have more controllers.

Still need to develop:
Create controller for selective groups or layer.
Add slider feature
etc (suggest any ideas if you have)

If you found any problem or error with the plugin let me know. I will fix them as soon as possible.

For now it supports angle, real values, vector. This covers most of things

8 Likes

How about to submit PR to include this plugin into Synfig? :slight_smile: - synfig/synfig-studio/plugins at master Ā· synfig/synfig Ā· GitHub

4 Likes

I think I should work more on this plugin more, like mentioned before.

Also features to interpolate between different colors with the controller and other primitive types are still need to be done.

I will submit PR once I implement the above features and test it more.

1 Like

Iā€™m thinking of doing a tutorial on this plugin but Iā€™m running some more tests first.

7 Likes

Hi,
Nice work on the plugin, but it does not seem to work when you move the controller to the down position. I made a plain circle in the middle of the canvas and added a waypoint. Then I moved the circle to the right, left, up and down and made waypoints accordingly. After successfully running the plugin, the circle reacted to every position of the controller, but when I moved the controller down, the circle stayed in place in the middle position.
Greetz.

Can you please share the .sif file

Edit: I checked it my self, yes itā€™s not working. I will fix it, thanks for reporting.

1 Like

This is fixed, try it out.

joystickPlugin.zip (4.1 KB)

3 Likes

Hi,
Thank you. It works fine now after the fix. I tested it with two controllers: one that controls a group and another that controls one shape of that same group. No problems. In combination with switch controls this plugin should provide some nice and very useful combinations.
Greetz.

Maybe you could have it use Z-Depth?

Iā€™m getting this error for some reason

error

This error occurred because there were no keyframes.
I have fixed it now.

joystickPlugin.zip (4.1 KB)

Adding keyframes isnā€™t compulsory, the error is fixed.

So you want ā€˜switch controlsā€™ (like on and off) or do you want to control the switch layer with the controller?

Switch controls (on and off switch) arenā€™t possible to create (may be possible, but not a good idea to create with plugin).

If you meant to control Switch Layer with the controller. I am working on it :+1: .

@Vinny58
The controller works for Z-Depth (it is a real value)

4 Likes

I tried to create a little demo on controlling the Switch Layer with the controller. And I donā€™t think it will work well with Synfig, even if I implement proper logic and connect the Switch Layer to the controller. Animating it would be hard, it has heavily nested values and Synfig will just crash if you try to move the controller.

Maybe I should try to make the logic more simple and easy to calculate.
Here is the demo file try it out,

demo.sif (77.1 KB)
Also suggest me any better way to implement it.

(Try adding a waypoint and Synfig will crash, even though we are just adding a waypoint for the controllerā€™s exported value, it just crashes)

Wouldnā€™t it be good if you make it a slider in this case? And you can sett the layer by index (Layer Depth parameter) instead of by layer name/description (Active Layer Name parameter), if you prefer to.

1 Like