Repository navigation
Expand file tree
/
Copy pathset-text-image-video.js
More file actions
69 lines (66 loc) · 2.31 KB
/
Copy pathset-text-image-video.js
File metadata and controls
69 lines (66 loc) · 2.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Copyright (c) 2018-present, Renderforest, LLC.
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory.
*/
const RenderforestClient = require('../../lib/client')
const Renderforest = new RenderforestClient({ signKey: '<signKey>', clientId: -1 })
Renderforest.getProjectData(16165971)
.then((projectDataInstance) =>
projectDataInstance.getScreen(0)
.getArea(0)
.setText('sample-text')
.setTextScale(120)
.returnProjectData()
.getScreen(1)
.getArea(0)
.setImage({
fileName: 'sample file name', // optional
mime: 'image/png', // optional
filePath: 'https://example.com/sample.png',
webpPath: 'https://example.com/sample.webp', // optional
fileType: 'image', // optional
thumbnailPath: 'https://example.com/sample-thumbnail.png', // optional
imageCropParams: {
transform: 0,
top: 11,
left: 0,
width: 798,
height: 456
},
colorFilters: { // optional
sepia: 0, // optional (range is between 0-1, default value is 0)
contrast: 1, // optional (range is between 0-2.5, default value is 1)
grayscale: 0, // optional (range is between 0-1, default value is 0)
saturate: 1, // optional (range is between 0-2.5, default value is 1)
huerotate: 0, // optional (range is between 0-360)
brightness: 1 // optional (range is between 0-2.5, default value is 1)
}
})
.returnProjectData()
.getScreen(2)
.getArea(0)
.setVideo({
fileName: 'sample file name', // optional
mime: 'video/mp4', // optional
filePath: 'https://example.com/sample.png',
webpPath: 'https://example.com/sample.webp', // optional
fileType: 'video', // optional
videoCropParams: {
duration: 6,
mime: 'video/mp4',
transform: 0, // angle of the video. Valid values are 0, 90, 180, 270
thumbnail: 'https://example.com/sample-thumbnail.png',
thumbnailVideo: 'https://example.com/sample-thumbnail-video.mp4',
trims: [0, 2, 3, 5],
volume: {
music: 10,
video: 100
}
}
})
.save()
)
.catch(console.error)