• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Behavior of inTangents and outTangents properties, composition layer mask

Engaged ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Hello everyone...

Using javasripr, I'm trying to create a copy (mask 1) from the first layer of the composition, to the second layer of the composition. The mask on the second layer should be offset (var vertShift = [90, 100]). The newly created mask on the second composition layer has different inTangents and outTangents values from the inTangents and outTangents values for (mask 1), the first composition layer Why is this happening???

 

// ---------------------------------------------------------------------

app.beginUndoGroup("U");

var vertShift = [90, 100];
app.project.activeItem.layer(1).mask("ADBE Mask Atom").maskPath.selected = true;
var CarentMask = app.project.activeItem.layer(1).mask(1);
var mask = app.project.activeItem.selectedProperties[0];
var maskShape = mask.maskShape;
var shape = maskShape.numKeys ? maskShape.valueAtTime(comp.time, false) : maskShape.value;

var verts = shape.vertices;

var inTangValue = maskShape.value.inTangents;
var outTangValue = maskShape.value.outTangents;

var vertsCount = verts.length - 1;
var arrayVertexIni = [];

for (f = 0; f <= vertsCount; f++) {
var resaltVertShift = []
var xShift = verts[f][0] - vertShift[0]
resaltVertShift.push(xShift)
var yShift = verts[f][1] - vertShift[1]
resaltVertShift.push(yShift)
arrayVertexIni.push(resaltVertShift);
}

newMask = app.project.activeItem.layer(2).Masks.addProperty("Mask");
newMaskShape = newMask.property("maskShape");
newShape = newMaskShape.value;
newShape.vertices = arrayVertexIni;
newShape.inTangents = maskShape.value.inTangents;
newShape.outTangValue = maskShape.value.outTangents;
newShape.closed = true;
newMaskShape.setValue(newShape);

// ---------------------------------------------------------------------

layers.jpg

TOPICS
Scripting

Views

227

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 04, 2022 Oct 04, 2022

Change this line:

newShape.outTangValue = maskShape.value.outTangents;

to this:

newShape.outTangents = maskShape.value.outTangents;

Votes

Translate

Translate
Community Expert ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Nor sure what's going on with your code, but are you just trying to have a duplicated shape but off to the side?

Using the pickwhip to link layer 2's mask directly to layer 1's would get the mask in the same space, then you could use the layer's position to adjust its position

Alternatively, if you used a shape layer, you could then apply a shape repeater to replicate the shape and transform its position.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Yes, that's the solution.... But the discussion question, "Behavior of inTangents and outTangents properties"..... Why doesn't my solution work????

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Change this line:

newShape.outTangValue = maskShape.value.outTangents;

to this:

newShape.outTangents = maskShape.value.outTangents;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

LATEST

Thanks Dan!!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

You're not setting the tangents on a per-point basis and simply assume the arrays would match. That's why they don't align or even simply revert to defaults. The mask points should be treated as triplet groups (point,in,out) and the mask be created from that.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines