/** * @module EmojiAnimation * @type {Object} * @author Ali Tugrul Pinar * @copyright Smartface 2020 */ import WebView from "@smartface/native/ui/webview"; interface EmojiAnimationOptions { /** * Should be an instance of @smartface/native/ui/webview * @see https://developer.smartface.io/docs/webview */ webView: WebView; /** * @default [] * Array of emojis will be played */ emojis?: string[]; /** * @default 100 * Width of emoji box(px) */ emojiBoxWidth?: number; /** * @default 80 * Width of emoji(px) */ emojiWidth?: number; /** * Toggles whether to override the webView.onError and webView.android.onConsoleMessage * @default false */ logEnabled?: boolean; } /** * @class * @author Ali Tugrul Pinar * @copyright Smartface 2020 * @example * ``` * import EmojiAnimation from '@smartface/extension-utils/lib/art/EmojiAnimation'; * * const emojiAnimation = new EmojiAnimation({ * emojis: ['data:image/png;base64,eymBASDASd'] * webView: this.wvEmojiAnimation * }); * * // Play first emoji on WebView with 3 second animation * emojiAnimation.playEmoji(0, 3); * ``` * @example * EmojiAnimation with an image inside the project * ``` * const emojiAnimation = new EmojiAnimation({ * emojis: [`data:image/png;base64,${Image.createFromFile("images://smartface.png").toBlob().toBase64()}`, 'data:image/png;base64,eymBASDASd'] * webView: this.wvEmojiAnimation * }); * * // Play two emojis on WebView with 3 second animation * emojiAnimation.playEmoji(0, 3); * emojiAnimation.playEmoji(1, 3); * ``` * @example * Or do it with forEach * ``` * const emojiAnimation = new EmojiAnimation({ * emojis: [`data:image/png;base64,${Image.createFromFile("images://smartface.png").toBlob().toBase64()}`, 'data:image/png;base64,eymBASDASd'] * webView: this.wvEmojiAnimation * }); * * // Play first emoji on WebView with 3 second animation * // Or use it with forEach. * emojiAnimation.emojis.forEach((_, index) => emojiAnimation.playEmoji(index, 3)); * ``` */ export default class EmojiAnimation { private __webView; private __emojis; private __emojiBoxWidth; private __emojiWidth; private __logEnabled; constructor(options: EmojiAnimationOptions); private initWebView; private loadHTML; /** * Play given index that emoji on WebView */ playEmoji(emojiIndex: number, timing: number): void; /** * To change emoji values, call the constructor(create new instance) again. */ get emojis(): string[]; private set emojis(value); } export {};