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

Applying a scale change through scripting

New Here ,
Mar 28, 2018 Mar 28, 2018

Copy link to clipboard

Copied

Hi,

I'm trying to get to grips with JavaScripting on Premiere Pro CC 12 and my first task is to apply a scale change to a series of videos which runs for the first second scaling from 100 to 200 and then for another second scaling from 200 to 300. It seems as though everything is being correctly set when debugging the script but in the project window the keys I've made are not showing up and the final scaling is applied from time 0 so the end effect is that it's full size from the outset.

what am I missing?

TIA

Richard

var proj = app.project;

var seq = proj.activeSequence;

var time = seq.getPlayerPosition();         // CTI = Current Time Indicator.

var time2 = seq.getPlayerPosition();

var time3 = seq.getPlayerPosition();

time2.seconds += 1;

time3.seconds += 2;

var videoTracks = seq.videoTracks;

for (var i = 0; i < videoTracks.numTracks; i++) {

var track = videoTracks;

for (var j = 0; j < track.clips.numItems; j++) {

var clip = track.clips;

if (clip.name == "Rectangle 720 576.png") {

for (var k = 0; k < clip.components.numItems; k++) {

var component = clip.components;

if (component.displayName == "Trajectoire") {       // Trajectory

for (var l = 0; l < component.properties.numItems; l++) {

var property = component.properties;

if (property.displayName == "Echelle") {        // Scale

if (!property.isTimeVarying()) {

property.setTimeVarying(true);

}

property.addKey(time);

property.addKey(time2);

property.addKey(time3);

var k = property.getKeys();

if (property.areKeyframesSupported() == true) {

var result = property.getValueAtKey(time);

property.setValueAtKey(time, 100, true);

property.setValueAtKey(time2, 200, true);

property.setValueAtKey(time3, 300, true);

}

}

}

}

}

}

}

}

TOPICS
SDK

Views

286

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 ,
Apr 15, 2018 Apr 15, 2018

Copy link to clipboard

Copied

LATEST

I'm a bit suspicious about the type being used (time2.seconds += 2). Usually JS performs implicit type conversion, but you might want to make sure you're really using floats and not getting int or even string by accident. Always perform explicit type conversions...

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