Skip to main content
Participant
March 12, 2024
Answered

ExtendScript add time to timeStart

  • March 12, 2024
  • 1 reply
  • 403 views

Hello,

 

I have problem with adding up two times, and seting up value:

 

var videoFile = project.importFile(new ImportOptions(contentFile)) - importing video file
var bumperVideoFile = project.importFile(new ImportOptions(bumperFile)) - importing bumper (also video file)
var durationBumper = bumperVideoFile.duration - reading duration of bumper file
 
var fadeIn = thisCSVRow[5] - this is parameter readed from csv file, its importing correctly, alert is showing correct value
  
mainVideoLayer.startTime = durationBumper - seting up start time of main video right after bumper - it's working fine
 
mainVideoLayer.opacity.setValuesAtTimes([mainVideoLayer.startTime,mainVideoLayer.startTime+fadeIn],[0,100]) - and this is not working, it's set opacity value 0 and 100 at same first frame of main video, its not adding "fadeIn" time - but when I use hardcoded value (some number, for example 2) its working correctly.
 
where is the problem, are mainVideoLayer.startTime and imported to fadeIn value are different type or something?
 
I checked and they don't add up
alert(mainVideoLayer.startTime + fadeIn) - gives me a startTime, and not startTime+fadeIn
but
alert(mainVideoLayer.startTime + 2) - gives me correct answer 
 
This topic has been closed for replies.
Correct answer Mathias Moehl

Have you tried parseFloat(fadeIn) to explicitly convert this value to a number?

 

1 reply

Mathias Moehl
Community Expert
Mathias MoehlCommunity ExpertCorrect answer
Community Expert
March 12, 2024

Have you tried parseFloat(fadeIn) to explicitly convert this value to a number?

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Participant
March 13, 2024

Thanks!

 

that solve the problem