[CLX] Motion. - Logo
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © cryptolinx - jango_blockchained - open 💙 source

//@version=5
indicator("[CLX] Motion. - Logo", overlay = true)


// ———— Simple Animated Logo/Tag Idea {
//
renderLogo(string _tagline, string _sizeLogo = size.huge, string _sizeTag = size.normal, color _colorLogo = #ff5252, color _colorTag = #ffffff96, _colorDecor = #ff525234, int _x = bar_index, float _y = 1000) =>
    // >>
    array.from(
     label.new(_x, _y, text = '', size = _sizeLogo, color = #00000000, textcolor = _colorLogo, text_font_family = font.family_default, style = label.style_label_center, textalign = text.align_center),
     label.new(_x, _y, text = '└', size = _sizeLogo, color = #00000000, textcolor = _colorDecor, text_font_family = font.family_default, style = label.style_label_upper_right, textalign = text.align_left),
     label.new(_x, _y, text = '┘', size = _sizeLogo, color = #00000000, textcolor = _colorDecor, text_font_family = font.family_default, style = label.style_label_upper_left, textalign = text.align_left),
     label.new(_x, _y, text = '┌', size = _sizeLogo, color = #00000000, textcolor = _colorDecor, text_font_family = font.family_default, style = label.style_label_lower_right, textalign = text.align_left),
     label.new(_x, _y, text = '┐', size = _sizeLogo, color = #00000000, textcolor = _colorDecor, text_font_family = font.family_default, style = label.style_label_lower_left, textalign = text.align_left),
     label.new(_x, _y, text = ' ', size = _sizeLogo, color = #00000000, textcolor = color.new(_colorLogo, 75), text_font_family = font.family_default, style = label.style_label_down, textalign = text.align_left),
     label.new(_x, _y, text = '\n\n\n\n' + _tagline, size = _sizeTag, color = #00000000, textcolor = _colorTag, text_font_family = font.family_monospace, style = label.style_label_up, textalign = text.align_left))
// }

// ———— Update Logo {
//
update(array <label> _logo, string _textLogo, string _textTagline, int _x = bar_index, float _y = 1000) =>
    // --
    if barstate.islast
        for i = 0 to array.size(_logo) - 1
            label.set_xy(array.get(_logo, i), _x, _y)
        label.set_text(array.get(_logo, 0), _textLogo)
        label.set_text(array.get(_logo, 6), _textTagline)
    // >>
    // void
// }

// ———— Import Motion Library {
//
import cryptolinx/Motion/10 as motion
// --
varip logoKf = motion.keyframe.new(1, 7)
string marquee = motion.transition(logoKf, _fx = 'marquee', _seq = 'M◞TION.M◟TION.M◜TION.M◝TION.', _subLen = 7)
varip taglineKf = motion.keyframe.new(4, 1)
motion.iteration(taglineKf, _seqArr = array.from('Showcase','Library'), _refill = true)
// --
var array <label> LOGO = renderLogo('A Pine Script™ Showcase -', size.huge)
update(LOGO, marquee, '\n\n\n\n' + '- A Pine Script™ ' + taglineKf.output + ' -')
// }

// # EOF