Context
createReplayLayerProperty
- Web
- Android
- IOS
import { createReplayLayerProperty } from '@picsart/web-replay-sdk/context';
function createReplayLayerProperty<T>(value: T, locked?: boolean, meta?: JsonObject): IReplayLayerProperty<T>
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| value | T | yes | The actual value of the property. It has generic type(depends on the actual property) |
| locked | boolean | no | Defines the layer's access. If set to true it is not possible to change the property. To make changes, one needs to turn this off(make the value false). Defaults to false |
| meta | JsonObject | no | Property related meta information. Defaults to {} |
Returns IReplayLayerProperty.
IReplayBaseLayerCreate
| Property | Type | Required | Description |
|---|---|---|---|
| name | string | yes | The name of the layer |
| uuid | UUIDString | no | A unique id for replay layer. It will be autogenerate if not provided |
| locked | boolean | no | Specifies if the layer is locked. Defaults to false |
| renderer | IRenderer | no | renderer of the layer |
| fallbackLayer | IReplayLayer | no | fallback layer when failed to load or execute renderer |
| annotation | string | yes | This is a string pointing the current layer media type, in order to be understandable for different tools. It is a free string, in case it matches for different tools, that means they can work with that layer.Here is the Picsart editors' current in used Layer media types |
| meta | JsonObject | no | Layer related meta information. Defaults to {} |
| props | - | - | The props information will be based on layer. This interface includes the common props only |
| props.x | number | no | The layer x coordinate. The value is in relative format. Defaults to 0. |
| props.y | number | no | The layer y coordinate. The value is in relative format. Defaults to 0. |
| props.scaleX | number | no | The layer scale by x coordinate. The value is in relative format. Defaults to 1. |
| props.scaleY | number | no | The layer scale by y coordinate. The value is in relative format. Defaults to 1. |
| props.hidden | boolean | no | The layer visibility. Defaults to false. |
| props.opacity | boolean | no | Changes the layer appearance alpha channel. The value range is from 0-100, in percents. Defaults to 100 |
| props.rotation | number | no | rotation of the layer. The value is in degrees. Value range 0 - 360. Defaults to 0 |
| props.duration | number | no | duration of how much the layer will be visible during the animation counted from startTime. For editing which does not include animation one can use -1, which will mean it does not disappear. Defaults to -1 |
| props.startTime | number | no | startTime of the layer when it must become visible. The value is in relative format. Defaults to 0 |
| props.blendMode | IReplayLayerBlendMode | no | Defines the blend mode of the layer. Defaults to source-over |
| props.animations | (Pick<IReplayAnimation<Props>, 'keyframes'> & Partial<Omit<IReplayAnimation<Props>, 'keyframes'>>)[] | no | An array of animations for the given layer. Props here is a generic type, which corresponds to the layer property keys, which are animated. |
createReplayGroupLayer
- Web
- Android
- IOS
import { createReplayGroupLayer } from '@picsart/web-replay-sdk/context';
function createReplayGroupLayer(params: IReplayGroupLayerCreate): IReplayGroupLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayGroupLayerCreate | yes | The required information for the layer to be created |
Returns IReplayGroupLayer.
IReplayGroupLayerCreate
type IReplayGroupLayerCreate = IReplayBaseLayerCreate<IReplayGroupLayerPropsCreate>;
IReplayGroupLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| width | number | yes | Specifies the group layer width. The value is in relative format. |
| height | number | yes | Specifies the group layer height. The value is in relative format. |
| children | UUIDString[] | no | Specifies the group child layers. Defaults to []. |
createReplayShapeLayer
- Web
- Android
- IOS
import { createReplayShapeLayer } from '@picsart/web-replay-sdk/context';
function createReplayShapeLayer(params: IReplayShapeLayerCreate): IReplayShapeLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayShapeLayerCreate | yes | The required information for the layer to be created |
Returns IReplayShapeLayer.
IReplayShapeLayerCreate
type IReplayShapeLayerCreate = IReplayBaseLayerCreate<IReplayShapeLayerPropsCreate>;
IReplayShapeLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| width | number | yes | The width of the layer. The value is in relative format. Defaults to 1 |
| height | IReplayStroke | yes | The height of the layer. The value is in relative format. Defaults to 1 |
| stroke | IReplayStroke | no | The stroke for the whole shape. The stroke is not considered inside shape's width and height. Defaults to null |
| shadow | IReplayShadow | no | The shadow for the shape. Defaults to null |
| shape | IReplaySvgResource | yes | The shape media resource. This property is holding the original resource of the shape(used when first time was rendered) |
| paths | IReplayLayerProperty<IReplayShapePath>[] | no | This property is used for editing the shape path. Defaults to [] |
createReplayImageLayer
- Web
- Android
- IOS
import { createReplayImageLayer } from '@picsart/web-replay-sdk/context';
function createReplayImageLayer(params: IReplayImageLayerCreate): IReplayImageLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayImageLayerCreate | yes | The required information for the layer to be created |
Returns IReplayImageLayer.
IReplayImageLayerCreate
type IReplayImageLayerCreate = IReplayBaseLayerCreate<IReplayImageLayerPropsCreate>;
IReplayImageLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| stroke | IReplayStroke | no | The stroke for the image. The stroke is not considered inside image width and height. Defaults to null |
| shadow | number | yes | The shadow for the image. Defaults to null |
| image | IReplayPhotoResource | yes | The image media resource |
createReplayVideoLayer
- Web
- Android
- IOS
import { createReplayVideoLayer } from '@picsart/web-replay-sdk/context';
function createReplayVideoLayer(params: IReplayVideoLayerCreate): IReplayVideoLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayVideoLayerCreate | yes | The required information for the layer to be created |
Returns IReplayVideoLayer.
IReplayVideoLayerCreate
type IReplayVideoLayerCreate = IReplayBaseLayerCreate<IReplayVideoLayerPropsCreate>;
IReplayVideoLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| volume | number | yes | Video volume is in percentage. Value range is from 0 to 100. |
| trimStart | number | yes | The millisecond within the video resource duration range from where to start the video |
| trimEnd | number | yes | The millisecond within the video resource duration range from where to end the video |
| repeat | boolean | no | flag (true or false) that determines whether the content in the layer should loop to match the layer's total duration. Defaults to false |
| speed | number | no | The playback speed of video content Defaults to 1.0. |
| muted | boolean | no | flag (true or false) that determines whether the video content should be muted (no sound output). Defaults to false |
| video | IReplayVideoResource | yes | The resource for the video |
createReplayAudioLayer
Creates an audio layer. Audio layer is missing the following properties from the base properties: x, y, scaleX, scaleY, hidden, opacity, rotation, blendMode.
- Web
- Android
- IOS
import { createReplayAudioLayer } from '@picsart/web-replay-sdk/context';
function createReplayAudioLayer(params: IReplayAudioLayerCreate): IReplayAudioLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayAudioLayerCreate | yes | The required information for the layer to be created |
Returns IReplayAudioLayer.
IReplayAudioLayerCreate
type PropsToExclude =
| 'x'
| 'y'
| 'scaleX'
| 'scaleY'
| 'hidden'
| 'opacity'
| 'rotation'
| 'blendMode';
type IReplayBaseLayerCreatePropsExcluded<T> = Omit<
IReplayBaseLayerCreate<T>['props'],
PropsToExclude
>;
type IReplayBaseLayerCreateWithoutProps<T> = Omit<IReplayBaseLayerCreate<T>, 'props'>;
type IReplayAudioLayerCreate = IReplayBaseLayerCreateWithoutProps<IReplayAudioLayerPropsCreate> & {
props: IReplayBaseLayerCreatePropsExcluded<IReplayAudioLayerPropsCreate>;
};
IReplayAudioLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| volume | number | yes | Audio volume is in percentage. Value range is from 0 to 100. |
| trimStart | number | yes | The millisecond within the audio resource duration range from where to start the audio |
| trimEnd | number | yes | The millisecond within the audio resource duration range from where to end the audio |
| repeat | boolean | no | flag (true or false) that determines whether the content in the layer should loop to match the layer's total duration. Defaults to false |
| speed | number | no | The playback speed of audio content Defaults to 1.0. |
| muted | boolean | no | flag (true or false) that determines whether the audio content should be muted (no sound output). Defaults to false |
| audio | IReplayAudioResource | yes | The resource for the audio |
createReplayTextLayer
- Web
- Android
- IOS
import { createReplayTextLayer } from '@picsart/web-replay-sdk/context';
function createReplayTextLayer(params: IReplayTextLayerCreate): IReplayTextLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayTextLayerCreate | yes | The required information for the layer to be created |
Returns IReplayTextLayer.
IReplayTextLayerCreate
type IReplayTextLayerCreate = IReplayBaseLayerCreate<IReplayTextLayerPropsCreate>;
IReplayTextLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| bend | number | no | Specifies how much the text has been bended. The value range is from -50 to 50. The bend is being calculated from the center of the text content. The negative values are moving the bending circle center away from the bottom side of the text. Correspondingly the positive values are moving the bending circle center away from the top side of the text. Note text content width is being changed if bending is applied. Defaults to 0 |
| width | number | yes | Specifies the text layer width. The value is in relative format. |
| path | string | no | Specifies the path on which text will be drawn. View box is considered absolute width/height of the text. |
| lineHeight | number | no | The line height of the text layer. Defaults to 1 |
| letterSpacing | number | no | The letter spacing of the text layer. Defaults to 0 |
| stroke | IReplayStroke | no | The stroke of the text. Defaults to null |
| shadow | IReplayShadow | no | The shadow of the text. Defaults to null |
| font | IReplayFontResource | yes | The font resource to be used for rendering the text layer |
| perspectivePoints | IReplayTextPerspectivePoints | no | The layer's perspective transformation box. Defaults to null |
| ranges | IReplayTextLayerRange[] | no | An array of text ranges. This value is holding the text content. Defaults to [] |
| alignment | IReplayTextLayerAlignment[] | no | The text content alignment. Defaults to center |
createReplayVisualLayer
Creates Visual layer. createReplayVisualLayer layer requires renderer property.
- Web
- Android
- IOS
import { createReplayVisualLayer } from '@picsart/web-replay-sdk/context';
| Parameters | Type | Required | Description |
|---|---|---|---|
| params | IReplayVisualLayerCreate | yes | The required information for the layer to be created |
IReplayVisualLayerCreate
type IReplayVisualLayerCreate = IReplayBaseLayerCreate<IReplayVisualLayerPropsCreate> & {
renderer: IRenderer;
};
IReplayVisualLayerPropsCreate
| Property | Type | Required | Description |
|---|---|---|---|
| width | number | yes | determines the resource size which is requested from the renderer |
| height | number | yes | determines the resource size which is requested from the renderer |
| renderer | JsonObject | no | This data must be used to provide the renderer the required information for content drawing |
findReplayLayerChildren
Finds the group layer's all child layers
- Web
- Android
- IOS
import { findReplayLayerChildren } from '@picsart/web-replay-sdk/context';
function findReplayLayerChildren(replay: IReplay, layerId: IReplayLayer['uuid']): IReplayLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
| layerId | IReplayLayer['uuid'] | yes | A replay layer id. NOTE this must be a group layer id, the method will fail otherwise |
Returns IReplayLayer[].
findReplayLayerParent
Finds the parent layer of the given layer id
- Web
- Android
- IOS
import { findReplayLayerParent } from '@picsart/web-replay-sdk/context';
function findReplayLayerParent(replay: IReplay, layerId: IReplayLayer['uuid']): IReplayGroupLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
| layerId | IReplayLayer['uuid'] | yes | A replay layer id |
Returns IReplayGroupLayer[].
findReplayTexts
Finds all the text layers
- Web
- Android
- IOS
import { findReplayTexts } from '@picsart/web-replay-sdk/context';
function findReplayTexts(replay: IReplay): IReplayTextLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayTextLayer[].
findReplayImages
Finds all the image layers
- Web
- Android
- IOS
import { findReplayImages } from '@picsart/web-replay-sdk/context';
function findReplayImages(replay: IReplay): IReplayImageLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayImageLayer[].
findReplayShapes
Finds all the image layers
- Web
- Android
- IOS
import { findReplayShapes } from '@picsart/web-replay-sdk/context';
function findReplayShapes(replay: IReplay): IReplayShapeLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayShapeLayer[].
findReplayAudios
Finds all the audio layers
- Web
- Android
- IOS
import { findReplayAudios } from '@picsart/web-replay-sdk/context';
function findReplayAudios(replay: IReplay): IReplayAudioLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayAudioLayer[].
findReplayVideos
Finds all the video layers
- Web
- Android
- IOS
import { findReplayVideos } from '@picsart/web-replay-sdk/context';
function findReplayVideos(replay: IReplay): IReplayVideoLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayVideoLayer[].
findReplayGroups
Finds for the given layerIds
- Web
- Android
- IOS
import { findReplayGroups } from '@picsart/web-replay-sdk/context';
function findReplayGroups(replay: IReplay): IReplayGroupLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
Returns IReplayGroupLayer[].
findReplayLayers
Finds for the given layerIds
- Web
- Android
- IOS
import { findReplayLayers } from '@picsart/web-replay-sdk/context';
function findReplayLayers(replay: IReplay, layerIds: IReplayLayer['uuid'][]): IReplayLayer[]
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| replay | IReplay | yes | A replay object structure |
| layerIds | layerIds: IReplayLayer['uuid'][] | yes | An array of layers ids |
Returns IReplayLayer[].
isReplayTextLayer
Checks if the layer is a text layer
- Web
- Android
- IOS
import { isReplayTextLayer } from '@picsart/web-replay-sdk/context';
function isReplayTextLayer(layer: IReplayLayer): layer is IReplayTextLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.
isReplayVideoLayer
Checks if the layer is a video layer
- Web
- Android
- IOS
import { isReplayVideoLayer } from '@picsart/web-replay-sdk/context';
function isReplayVideoLayer(layer: IReplayLayer): layer is IReplayVideoLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.
isReplayAudioLayer
Checks if the layer is a audio layer
- Web
- Android
- IOS
import { isReplayAudioLayer } from '@picsart/web-replay-sdk/context';
function isReplayAudioLayer(layer: IReplayLayer): layer is IReplayAudioLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.
isReplayShapeLayer
Checks if the layer is a shape layer
- Web
- Android
- IOS
import { isReplayShapeLayer } from '@picsart/web-replay-sdk/context';
function isReplayShapeLayer(layer: IReplayLayer): layer is IReplayShapeLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.
isReplayGroupLayer
Checks if the layer is a group layer
- Web
- Android
- IOS
import { isReplayGroupLayer } from '@picsart/web-replay-sdk/context';
function isReplayGroupLayer(layer: IReplayLayer): layer is IReplayGroupLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.
isReplayImageLayer
Checks if the layer is a image layer
- Web
- Android
- IOS
import { isReplayImageLayer } from '@picsart/web-replay-sdk/context';
function isReplayImageLayer(layer: IReplayLayer): layer is IReplayImageLayer
import com.picsart.media.actions.ActionMeta.Source
| Parameters | Type | Required | Description |
|---|---|---|---|
| layer | IReplayLayer | yes | A replay layer |
Returns a boolean.