▮ FEATURES
Example: UI Price-Ticker
![[CLX][#01] Animation - Price Ticker (Marquee)](https://s3.tradingview.com/1/1jhinKYw_mid.png)
----------------------------------------------------------------------------
Library "Motion"
_getStringMono(_len, _str, _sep)
Parameters:
_len
_str
_sep
marquee(this, _extern, _ws, _subLen, _subStart)
Parameters:
this
_extern
_ws
_subLen
_subStart
transition(this, _subLen, _subStart)
Parameters:
this
_subLen
_subStart
hold(this)
Parameters:
this
keyframe
keyframe A keyframe object.
Fields:
seq
intv
step
length
update_no
frame_no
ltr
hold
- Now as library version :)
- String-based transition-effects
- Performance optimization. Reduced memory consumption up to >90% by kicking the output to the "stdout".
- Use marquee- or loader-effect on any possible string location.
Example: UI Price-Ticker
![[CLX][#01] Animation - Price Ticker (Marquee)](https://s3.tradingview.com/1/1jhinKYw_mid.png)
----------------------------------------------------------------------------
Library "Motion"
_getStringMono(_len, _str, _sep)
Parameters:
_len
_str
_sep
marquee(this, _extern, _ws, _subLen, _subStart)
Parameters:
this
_extern
_ws
_subLen
_subStart
transition(this, _subLen, _subStart)
Parameters:
this
_subLen
_subStart
hold(this)
Parameters:
this
keyframe
keyframe A keyframe object.
Fields:
seq
intv
step
length
update_no
frame_no
ltr
hold
Notas de Lançamento
▮ v2- Bug fix: Removed "typo" in str.format().
- Bug fix: Removed "out of bounds" on string length change.
- Updated: User inputs.
- New: Changelog.
👀 STILL UNDER DEVELOPMENT! Frequently updated!
Added:
nz(_src, _replacement)
Parameters:
_src
_replacement
Updated:
keyframe
keyframe A keyframe object.
Fields:
seq
intv
step
length
update_no
frame_no
pointer
ltr
hold
Notas de Lançamento
▮ v3- Bug fix: The `_ws` whitespace parameter in the marquee function should now working like expected. Thx to HeWhoMustNotBeNamed
Notas de Lançamento
v4▮ v4
- Removed unnecessary exports
Removed:
nz(_src, _replacement)_getStringMono(_len, _str, _sep)
Notas de Lançamento
v5Notas de Lançamento
v6Added:
start(this)
Parameters:
this
stop(this)
Parameters:
this
toggle(this)
Parameters:
this
reset(this)
Parameters:
this
reverse(this)
Parameters:
this
transition
transition A transition object.
Fields:
fx
max_loops
sub_start
sub_length
refill
external_seq
type
dir
side
Updated:
transition(this, _fx, _maxLoops, _subLen, _subStart, _ltr, _autoplay, _refill, _series)
Parameters:
this
_fx
_maxLoops
_subLen
_subStart
_ltr
_autoplay
_refill
_series
keyframe
keyframe A keyframe object.
Fields:
seq
ws
intv
step
update_no
frame_no
loop_no
length
pointer
ltr
__transition
execution
setup
Removed:
marquee(this, _extern, _ws, _subLen, _subStart)
hold(this)
Notas de Lançamento
v7Notas de Lançamento
v8Updated:
keyframe
keyframe A keyframe object.
Fields:
seq
ws
intv
step
fx
max_loops
sub_start
sub_length
refill
ltr
external_seq
type
dir
side
update_no
frame_no
loop_no
length
pointer
execution
setup
Removed:
transition
transition A transition object.
Bug Fixes:
-- LTR & Placeholder feature should now working like expected.
Notas de Lançamento
▮ v9 Major UpgradeThis update is a major upgrade to the library. The library now uses a more object-oriented approach, while the exported functions are now more user-friendly. Additional string effects are added.
Updated:
transition()
keyframe
New Secondary Functions:
prev(this, _skip)
next(this, _skip)
New Simplified Functions:
marquee(this, _seq, _ws, _maxLoops, _ltr)
slideInLeft(this, _seq, _ws, _maxLoops, _refill)
slideOutLeft(this, _seq, _ws, _maxLoops, _refill)
slideInRight(this, _seq, _ws, _maxLoops, _refill)
slideOutRight(this, _seq, _ws, _maxLoops, _refill)
blink(this, _seq, _ws, _maxLoops)
Also refactored most of the utility functions.
================================================================================
▮ Setup
To use this library in your scripts, you must first import it. To do this, add the following line to the top of your script:
Pine Script®
import cryptolinx/Motion/1 as motion
Next, create a `keyframe` object by using the `varip` keyword.
Pine Script®
varip myKeyframe = motion.keyframe.new(_intv = 1, _steps = 1,)
Based on your needs, you can now use one of the simplified functions to create a transition effect, or you can use the `transition()` or `iteration()` function to create a custom transition effect.
Simplified Functions:
(direct output)
Pine Script®
// motion.marquee(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _ltr)
motion.marquee(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideInLeft(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideInLeft(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideOutLeft(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideOutLeft(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideInRight(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideInRight(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideOutRight(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideOutRight(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.blink(keyframe myKeyframe, string _seq, int _ws, int _maxLoops)
motion.blink(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
motion.marquee(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideInLeft(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideInLeft(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideOutLeft(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideOutLeft(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideInRight(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideInRight(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.slideOutRight(keyframe myKeyframe, string _seq, int _ws, int _maxLoops, bool _refill)
motion.slideOutRight(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
// motion.blink(keyframe myKeyframe, string _seq, int _ws, int _maxLoops)
motion.blink(myKeyframe, 'Hello World!', 3, 0) // 0 = infinite loops
(indirect output)
Pine Script®
// After you create a transition, you can use the output field of the `keyframe` object to output the result
// motion.marquee(myKeyframe, 'Hello World!', 3, 0)
myKeyframe.output
// motion.marquee(myKeyframe, 'Hello World!', 3, 0)
myKeyframe.output
Note: The transition() function doesn't store anything at the output field, to not overload the object with unnecessary long varip string data.
Example advanced transition() usage:
![[CLX][#01] Animation - Price Ticker (Marquee)](https://s3.tradingview.com/1/1jhinKYw_mid.png)
================================================================================
Here are some numbers about the update frequency:
Notas de Lançamento
v10- code improvements
- bug fixes
- new fx
Notas de Lançamento
🚀 v11- new motion color_gradient() fx
- new fadeIn/Out() fx
- added missing simplified blend-effects
📑 ADDED
color_gradient(this, _color_from, _color_to, _transp_from, _transp_to, _steps, _maxLoops, _resetOnEveryBar, _autoplay, _cycle, _timerType, _timerMu, _timerStart, _timerMode)
// --
fadeIn(this, _color_from, _color_to, _steps, _transp_from, _transp_to, _maxLoops, _timerType)
fadeOut(this, _color_from, _color_to, _steps, _transp_from, _transp_to, _maxLoops, _timerType)
// --
blendInLeft(this, _seq, _ws, _maxLoops, _refill, _timerType)
blendOutLeft(this, _seq, _ws, _maxLoops, _refill, _timerType)
blendInRight(this, _seq, _ws, _maxLoops, _refill, _timerType)
blendOutRight(this, _seq, _ws, _maxLoops, _refill, _timerType)
📑 UPDATED:
marquee(this, _seq, _ws, _maxLoops, _ltr, _timerType)
// --
blink(this, _seq, _ws, _maxLoops, _timerType)
// --
slideInLeft(this, _seq, _ws, _maxLoops, _refill, _timerType)
slideOutLeft(this, _seq, _ws, _maxLoops, _refill, _timerType)
slideInRight(this, _seq, _ws, _maxLoops, _refill, _timerType)
slideOutRight(this, _seq, _ws, _maxLoops, _refill, _timerType)
Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Biblioteca do Pine
No verdadeiro espirito do TradingView, o autor desse código Pine o publicou como uma biblioteca de código aberto, para que outros programadores Pine da nossa comunidade possam reusa-los. Parabéns ao autor! Você pode usar essa biblioteca privadamente ou em outras publicações de código aberto, mas a reutilização desse código em publicações é regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.