Screentop lets you quickly edit multiple entities at once using just a bit of JavaScript. In the edit modal you should see an input that contains something like like this:
function editVariant(variant, index) {
return {
};
}
As you modify this function, the JSON representation of the entities will update automatically.
Try it out by editing some variants with this example:
function editVariant(variant, index) {
return {
name: `Example ${index}`,
fillColor: "red"
};
}
This will update the selected variant Names to "Example 1", "Example 2", ... and Fill Colors to red.
You can review the updated values in the JSON input and Save to confirm these changes.
function editVariant(variant, index) {
return {
asset: "Asset 1",
// Outputs 1, 2, ...
assetIndex: index,
};
}
const IMAGES_PER_ASSET = 10;
function editVariant(variant, index) {
return {
asset: `Asset ${Math.floor((index - 1) / IMAGES_PER_ASSET) + 1}`,
assetIndex: ((index - 1) % IMAGES_PER_ASSET) + 1,
};
}
function editVariant(variant, index) {
return {
backAsset: "Asset 1",
backAssetIndex: 1,
};
}
function editObject(object, index) {
return {
// Outputs "Variant 1", "Variant 2", ...
variant: `Variant ${index}`,
};
}
function editObject(object, index) {
return {
x: object.x + 32,
y: object.y + 32,
};
}
const COLUMNS = 5;
const ROWS = 5;
const CELL_WIDTH = 32;
const CELL_HEIGHT = 32;
function editAnchor(anchor, index) {
const column = (index - 1) % COLUMNS;
const row = Math.floor((index - 1) / COLUMNS);
return {
// Outputs -64, -64, -64, ...
x: column * CELL_WIDTH - (COLUMNS - 1) * CELL_WIDTH / 2,
// Outputs -64, -32, -0, ...
y: row * CELL_HEIGHT - (ROWS - 1) * CELL_HEIGHT / 2,
};
}