UNPKG

@cloudinary/url-gen

Version:

You are invited to influence our new SDK [Click here to view github discussion](https://github.com/cloudinary/js-url-gen/discussions/602) =========================

54 lines (50 loc) 1.64 kB
'use strict'; var LayerAction = require('./LayerAction-bfa64a00.cjs'); /** * @description Adds a video, text or an image layer as an overlay over the base layer. </br> * @memberOf Actions * @namespace Overlay * @see Visit {@link Qualifiers.TextStyle|TextStyle} for advanced text options * @see {@link Actions.Underlay| The underlay action} * @example * import {Cloudinary} from "@cloudinary/url-gen"; * * const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}}); * const myVideo = yourCldInstance.video('dog'); * * import {source} from "@cloudinary/url-gen/actions/overlay" * import {image, video, text} from "@cloudinary/url-gen/qualifiers/source" * import {TextStyle} from '@cloudinary/url-gen/qualifiers/textStyle * * myVideo.overlay( * source(image('myImage')) * ) * * myVideo.overlay( * source(video('myVideo')) * ) * * myVideo.overlay( * source(text('My text'), 'arial_15') * ) * * // Or a text with more complex options * myVideo.overlay( * source(text('My text'), new TextStyle('arial', 50)) * ) */ /** * @summary action * @memberOf Actions.Overlay * @description Adds a layer for an asset * @param {Qualifiers.Source.ImageSource | Qualifiers.Source.TextSource | Qualifiers.Source.VideoSource} source * The Source used for the layer, use the functions provided {@link Qualifiers.Source|here} to easily create these objects * @return {SDK.LayerAction} */ function source(source) { return new LayerAction.LayerAction(source) .setLayerType('l'); } const Overlay = { source }; exports.Overlay = Overlay; exports.source = source;