Transition information from XD file

Hi ,

Can someone please help me out to get transition information from XD file in Javascript.(custom plugin).

Thanks in advance !!!

1 Like

Hi @Ashish,

Since XD 19, you can use the interactions module for retrieving all transition data for a document (see https://adobexdplatform.com/plugin-docs/reference/interactions.html?h=interaction). Also, since that release, you can get per-node data by using SceneNode.triggeredInteractions, see https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#scenenodetriggeredinteractions--arrrayinteraction.

With this, you can, e.g., retrieve such info like this:

const interactions = require('interactions');

function main(selection, root) {
    console.log('Selection node transition data:');
    const selectionInteractions = selection.items[0].trigerredInteractions;
    console.log(JSON.stringify(selectionInteractions));
    console.log('All interactions:');
    console.log(JSON.stringify(interactions.allInteractions));
}

module.exports.commands = { main }

I hope this helps :wink:, and, by the way: Welcome to the forums :wave::slightly_smiling_face:

2 Likes

Hi @pklaschka ,

Thanks for your help. i used Interactions module and got the below JSON
“interactions”: [
{
“trigger”: {
“type”: “tap”
},
“action”: {
“type”: “goToArtboard”,
“destination”: {
“_childrenList”: {}
},
“preserveScrollPosition”: false,
“transition”: {
“type”: “push”,
“fromSide”: “L”,
“easing”: “ease-out”,
“duration”: 0.3
}
}
}
]

in the above JSON, Destination Artboard node info not exists. May you please sugggest me how to get these information.

Thanks,
Ashish

@Ashish

destination field should give you that information. Try console.loging that property only (drill down to it). Ref: https://adobexdplatform.com/plugin-docs/reference/interactions.html?h=interactions