Animation problems, 2 geometries in 1 display

I have a problem with an animation, I have 2 geometries inside 1 display and in the api I only find 1 display. I have put a graft in the geometry display and it returns 2 contents. But in the api I don’t know how to select only 1 of the 2 geometries. The mode Sub interaction does not work for me or I do not do well.

Tree branches are represented as an array in the API and you can access them with this call:

api.scene.get({name:"NAME_OF_YOUR_DISPLAY_PUTPUT", format:"glb"},"CommPlugin_1").data[0].content

See more in this post and Documentaion:

But how can I add an animation to each branch?

When you define an animation object, you can specify a scenePath (see here).

A scene path is a dot separated string of the form PLUGIN_ID.ASSET_ID.CONTENT_ID. The last part is optional: if you don’t specify CONTENT_ID, the whole asset (typically one display component) will be used for the transformation. If you use CONTENT_ID, only one element of the content array will go through the transformation.

So if you have a Display content with a tree that has two branches, and if your code does not specify a custom comm plugin name, you can access each branch with a path of the following form:
"CommPlugin_1.ASSET_ID.content_0" (first element of the content array in the asset)
"CommPlugin_1.ASSET_ID.content_1" (second element of the content array in the asset)