Skip to main content
Participant
July 5, 2019
Answered

setValueAtKey and addKey on Pictures

  • July 5, 2019
  • 2 replies
  • 2522 views

Hello everybody,

Can you say me if Premiere SDK supports addKey on pictures ?

When I attempt to add addKey (on opacity) on movies, it works, but if I try on pictures (.jpg, .png...), it doesn't work : I used this script (https://forums.adobe.com/thread/2471227)

I don't understand, anyone can help me ? 2 weeks that I'm looking for, I'm going crazy. Thank you.

    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; 

    var track = videoTracks[0]; 

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

            var clip = track.clips

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

                    var component = clip.components

                        // Trajectory 

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

                            var property = component.properties

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

                                // 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); 

                                } 

                        } 

                    } 

               } 

        } 

This topic has been closed for replies.
Correct answer Bruce Bullis

You're right! I was able to reproduce the behavior.

We're tracking this as DVAPR-4217831: "setValueAtKey() fails to work correctly, when applied to a still image; same code works fine when target is video".

I'll keep you informed of our progress.

2 replies

Participating Frequently
December 30, 2019

can anyone solve it?

aminn75893596
Inspiring
August 10, 2021

Also facing the same issue. 

 

Please let me know if there are any updates. Thanks!

aminn75893596
Inspiring
August 10, 2021

Nevermind, solved it after watching this tutorial: https://youtu.be/cmwzXL6pRfw

Bruce Bullis
Community Manager
Community Manager
July 8, 2019

At first glance, it appears you're trying to set the value of opacity to 100, 200, than 300.


I think 100 is the maximum opacity value; you could check the opacity values of a still set to fully transparent, and one set to fully opaque. I'll have a look, time permitting.

Participant
July 8, 2019

In fact, I loop and I only select the property "Scale" and not opacity.

The value is changed but no keyframes are created, despite the 3 addKey statements.

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
July 11, 2019

You're right! I was able to reproduce the behavior.

We're tracking this as DVAPR-4217831: "setValueAtKey() fails to work correctly, when applied to a still image; same code works fine when target is video".

I'll keep you informed of our progress.