If I am working with an artboard which contains rectangles, I need to duplicate the artboard with those rectangles and I must change the co-ordinates of the rectangle in the duplicated artboard only (just to animate).
Use commands.duplicate() to clone the Artboard node, then on each Rectangle use APIs from the SceneNode base class like moveInParentCoordinates(), placeInParentCoordinates() or the translation setter to change positions as desired.
You may also want to read the general docs about coordinate systems in XD since nested coordinate systems can be confusing if you’ve never worked with them before.
Thanks! That works!
So If i want to change the parentCoordinates of the rectangles in the duplicated artboard, first I must select the duplicated artboard. What should I do to select the duplicated artboard?
No need. Only the commands APIs require you to select the nodes you want to change (because they’re literally automating commands from XD’s UI). Other operations like changing node position don’t require you to make the node selected first.
But In order to make changes over the nodes in " Duplicated artboard " alone, I have to select the duplicated artboard right. If I select a node with the node name, for example - if my node is “fgRect”. If I select them using " selection.items=[fgRect] " and change their co-ordinates, will they affect the homeArtboard rectangle? Since both the artboard contains same rectangle name “fgRect”.