pasteInto(source, destination)

Paste the source page item into the destination item, which then acts like a clipping mask. Optionally, set to a variable, to immediately access the new page item inside your destination.

Type: function

Parameter(s):

  • source {PageItem}:

    The page item to copy.

  • destination {PageItem}:

    The page item to paste the source into.

Returns:

  • {Object}:

    The new page item inside the destination.

Example(s):

Use ellipse as clipping mask for textframe.

noStroke();
textSize(50);

fill(0);
var myText = text(LOREM, 0, 0, width, height);

noFill();
var myMask = ellipse(width / 2, height / 2, width / 2, height / 2);

myMaskItem = pasteInto(myText, myMask);

property(myMaskItem, 'fillColor', color(0, 255, 0));

Use ellipse as clipping mask for rect.

noStroke();

fill(255, 0, 0);
var myRect = rect(0, 0, width / 2, height / 2);

fill(0, 0, 255);
var myMask = ellipse(width / 2, height / 2, width / 2, height / 2);

myMaskItem = pasteInto(myRect, myMask);

property(myMaskItem, 'fillColor', color(255, 0, 255));