polotno-node
Advanced tools
Comparing version 2.9.24 to 2.9.25
{ | ||
"name": "polotno-node", | ||
"version": "2.9.24", | ||
"version": "2.9.25", | ||
"description": "Polotno workflow from NodeJS", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"pngjs": "^7.0.0", | ||
"polotno": "^2.7.1", | ||
"polotno": "^2.8.3", | ||
"react": "^18.3.1", | ||
@@ -32,0 +32,0 @@ "react-dom": "^18.3.1", |
@@ -130,3 +130,3 @@ const fs = require('fs'); | ||
// loop through the images and add each to the animation | ||
const framesNumber = Math.floor((duration / 1000) * fps); | ||
const framesNumber = Math.floor((duration / 1000) * fps) || 1; | ||
const frames = Array.from(Array(framesNumber).keys()); | ||
@@ -241,8 +241,13 @@ | ||
for (const page of json.pages) { | ||
const pageDuration = page.duration || 5000; | ||
for (const el of page.children) { | ||
if (el.type === 'video') { | ||
const elStartTime = el.startTime * el.duration; | ||
const startTime = el.startTime || 0; | ||
const endTime = el.endTime || 1; | ||
const dur = el.duration || 5000; | ||
const elStartTime = startTime * dur; | ||
const elDuration = Math.min( | ||
page.duration, | ||
el.duration * (el.endTime - el.startTime) | ||
pageDuration, | ||
dur * (endTime - startTime) | ||
); | ||
@@ -256,7 +261,7 @@ const elEndTime = elStartTime + elDuration; | ||
outputStartTime: pageStartTime, | ||
outputEndTime: pageStartTime + page.duration, | ||
outputEndTime: pageStartTime + pageDuration, | ||
}); | ||
} | ||
} | ||
pageStartTime += page.duration; | ||
pageStartTime += pageDuration; | ||
} | ||
@@ -266,3 +271,2 @@ | ||
console.time('ffmpeg'); | ||
await new Promise((resolve, reject) => { | ||
@@ -314,5 +318,4 @@ const ffmpegCmd = ffmpeg() | ||
} finally { | ||
console.timeEnd('ffmpeg'); | ||
fs.rmSync(tempFolder.name, { recursive: true }); | ||
} | ||
}; |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1236950
5580