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

Is there a way to change the time property of a Marker?

Explorer ,
Jun 05, 2020 Jun 05, 2020

Copy link to clipboard

Copied

Hi,

I am trying to control the time of an existing Marker. 

Would something like below be possible?

myComp.layer("MYLAYER").property("Marker").setValueAtTime(myArray[0], "MarkerName");

It doesn't want to run because of "MarkerName", of course, but this is what I was hoping to achieve...is there another possible approach?

I attached for clarity what I want to be able to control with JavaScript..

Thank you! Screen Shot 2020-06-05 at 9.17.48 AM.png

TOPICS
How to , Scripting

Views

513

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 , Jun 05, 2020 Jun 05, 2020

There's no way (that I know of) to change the time property of a marker. You'd have to harvest the marker value, remove the marker, and create a new one (using the old value) at the new time:

 

var myArray = [5];
var myComp = app.project.activeItem;
var myLayer = myComp.layer("MYLAYER");
var myMarkerVal = myLayer.property("Marker").keyValue("MarkerName");
var myTime = myLayer.property("Marker").keyTime("MarkerName");
var myIdx = myLayer.property("Marker").nearestKeyIndex(myTime);
myLayer.property("Marke

...

Votes

Translate

Translate
Community Expert ,
Jun 05, 2020 Jun 05, 2020

Copy link to clipboard

Copied

There's no way (that I know of) to change the time property of a marker. You'd have to harvest the marker value, remove the marker, and create a new one (using the old value) at the new time:

 

var myArray = [5];
var myComp = app.project.activeItem;
var myLayer = myComp.layer("MYLAYER");
var myMarkerVal = myLayer.property("Marker").keyValue("MarkerName");
var myTime = myLayer.property("Marker").keyTime("MarkerName");
var myIdx = myLayer.property("Marker").nearestKeyIndex(myTime);
myLayer.property("Marker").removeKey(myIdx);
myLayer.property("Marker").setValueAtTime(myArray[0],myMarkerVal);

 

I think that will work, although you might be able to do it in fewer steps.

 

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
Explorer ,
Jun 05, 2020 Jun 05, 2020

Copy link to clipboard

Copied

Thank you very much, Dan! For replying so quickly and for being available for the community...it's much appreciated.

That was exactly what I was afraid of :). Too bad...I started to work on your suggestion last night...but I posted the question hoping that I was wrong...

 

Thank you again,

A.

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
Explorer ,
Jun 05, 2020 Jun 05, 2020

Copy link to clipboard

Copied

LATEST

FYI...it is working! I was able to change the time with that script...just awesome.

THANK YOU!

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