Skip to main content
Participant
January 22, 2024
Answered

How to create a effect of an object "moving" on each right page of the book?

  • January 22, 2024
  • 2 replies
  • 343 views

Hello, I was commissioned to make something similar. The illustration is to be on almost every right-hand page, but its position is to vary slightly to get the effect you see in the video. Is there any way to handle this fairly efficiently, or will I have to insert each graphic individually? I'm a beginner to InD, so would appreciate any help

 

https://www.instagram.com/abookeachday/reel/C2UQ97srzZA/

This topic has been closed for replies.
Correct answer Steve Werner

I notice you tagged "Scripting" as a topic for this question. 

 

I don't think this is something a beginner to InDesign could manage, but you might get (or pay) someone to create a script. You'd have to define the x, y position of the image on each page.

2 replies

Rene Andritsch
Community Expert
Community Expert
January 22, 2024

@Michał349516332a04 I tried to create a script with ChatGPT and it came up with this script that so far only works with regular objects but not with image frames. You have to define an object style that is applied to the object on the paretn page. Then create as many pages as you need with the object on it. Afterwards select all pages and override all parent page items. then you can run the script. this is just a starting point but maybe someone might want to iterate on it or you try to tinker yourself with ChatGPT:

// InDesign Script to move and optionally scale all objects with a specific object style incrementally

// Define the object style name
var targetObjectStyle = "YourObjectSytle"; // Change this to your actual object style name

// Prompt the user for X and Y increments, starting scale increments in percentage, and starting values
var xStartIncrement = parseFloat(prompt("Enter starting X increment:", "5"));
var yStartIncrement = parseFloat(prompt("Enter starting Y increment:", "3"));

// Ask the user if they want to apply scaling
var applyScaling = confirm("Do you want to apply scaling?", false);

var scaleStartIncrementPercent = 0;
if (applyScaling) {
scaleStartIncrementPercent = parseFloat(prompt("Enter starting scale increment (in percentage):", "10"));
}

// Function to move and optionally scale objects with the specified object style incrementally
function moveAndScaleObjects(xStartIncrement, yStartIncrement, scaleStartIncrementPercent) {
var modifiedObjects = [];
var xOffset = 0;
var yOffset = 0;
var scaleOffset = applyScaling ? 1 : 0; // Initialize scale offset

// Loop through each page in the document
for (var pageIndex = 0; pageIndex < app.activeDocument.pages.length; pageIndex++) {
var currentPage = app.activeDocument.pages[pageIndex];

// Check if there are page items with the specified object style on the current page
var itemsWithStyle = currentPage.pageItems.everyItem().getElements();
for (var itemIndex = 0; itemIndex < itemsWithStyle.length; itemIndex++) {
var currentItem = itemsWithStyle[itemIndex];

// Check if the current item has the specified object style
if (currentItem.appliedObjectStyle.name === targetObjectStyle) {
// Move the current item incrementally
currentItem.move(undefined, [xOffset, yOffset]);

// Optionally scale the current item incrementally
if (applyScaling) {
currentItem.resize(
CoordinateSpaces.PASTEBOARD_COORDINATES,
AnchorPoint.CENTER_ANCHOR,
ResizeMethods.MULTIPLYING_CURRENT_DIMENSIONS_BY,
[(1 + scaleOffset * scaleStartIncrementPercent / 100), (1 + scaleOffset * scaleStartIncrementPercent / 100)]
);

// Update the scale offset for the next item
scaleOffset ++;
}

modifiedObjects.push(currentItem);

// Update the offsets for the next item
xOffset += xStartIncrement;
yOffset += yStartIncrement;
}
}
}

// Alert to indicate the script has completed
if (modifiedObjects.length > 0) {
alert("Modified " + modifiedObjects.length + " objects with the specified object style.");
} else {
alert("No objects found with the specified object style.");
}
}

// Run the script
moveAndScaleObjects(xStartIncrement, yStartIncrement, scaleStartIncrementPercent);

Steve Werner
Community Expert
Steve WernerCommunity ExpertCorrect answer
Community Expert
January 22, 2024

I notice you tagged "Scripting" as a topic for this question. 

 

I don't think this is something a beginner to InDesign could manage, but you might get (or pay) someone to create a script. You'd have to define the x, y position of the image on each page.