Skip to content

Commit 331a22d

Browse files
root(README): add documentation for new screen and area methods.
- fixes #144
1 parent 72771ec commit 331a22d

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Welcome to the Renderforest API! You can use our API to:
4545
- [Set voice-over](#set-voice-over)
4646
- [Set mute music](#set-mute-music)
4747
- [Set sounds](#set-sounds)
48+
- [Set screen duration](#set-screen-duration)
49+
- [Set icon position](#set-the-icon-position)
4850
- [Set text on text holder area](#set-text-on-text-holder-area)
4951
- [Set image on image holder area](#set-image-on-image-holder-area)
5052
- [Set video on video holder area](#set-video-on-video-holder-area)
@@ -482,6 +484,46 @@ const sounds = [ sound1, sound2 ]
482484
projectDataInstance.setSounds(sounds)
483485
```
484486

487+
##### Set screen duration
488+
489+
It's possible to check if `screen` duration is adjustable, get current screen duration via `calculateScreenDuration`,
490+
get maximum possible duration for current screen, and to set your desired duration.
491+
```js
492+
const screens = projectDataInstance.getScreens()
493+
494+
if (screens && screens[0]) {
495+
const isAdjustable = screens[0].isDurationAdjustable()
496+
497+
if (isAdjustable) {
498+
const calculateDuration = screens[0].calculateScreenDuration()
499+
console.log(calculateDuration)
500+
const maxDuration = screens[0].getMaxPossibleDuration()
501+
const desiredDuration = 5
502+
503+
if (desiredDuration <= maxDuration) {
504+
screens[0].setDuration(desiredDuration)
505+
}
506+
}
507+
}
508+
```
509+
510+
##### Set icon position
511+
512+
There is two methods `isIconPositionAdjustable` and `changeIconPosition`.
513+
The first one checks if it's possible to adjust icon position. If it returns `0` then it's not possible,
514+
if a number is greater than `0` it means that icon position is adjustable.
515+
The value `1` stands for the right position, accordingly, the value `2` stands for left position.
516+
For changing the icon position here is `changeIconPosition` method. It changes icon position value `1<-->2`.
517+
```js
518+
const screens = projectDataInstance.getScreens()
519+
520+
if (screens && screens[0]) {
521+
if (screens[0].isIconPositionAdjustable()) {
522+
screens[0].changeIconPosition()
523+
}
524+
}
525+
```
526+
485527
##### Set text on text holder area
486528
```js
487529
const screens = projectDataInstance.getScreens()

0 commit comments

Comments
 (0)