ARSA Language  2.8
(Encryption, GPU and Web 3.0)
lottie.h File Reference

Go to the source code of this file.

Functions

int lottie (const char *filename, const char *command)
 operations lottie files in json format More...
 

Detailed Description

Lottie animation commands.
A Lottie is a JSON-based animation file format that enables designers to ship animations on any platform as easily as shipping static assets.
They are small files that work on any device and can scale up or down without pixelation.

More info:
https://lottiefiles.com

2022_3_19 !!!Founded BUG!!!
Only file: vocalno.json when resize texture to 960x960 pixel then lottie will freeze.


Example:

{
set($id, lottie("start.json", "load")) // load lottie
lottie($id, "resize", 1280, 720) // set quality
lottie($id, "playat", "video") // play lottie on psd layer, !!!MUST clear playat with layer name after you done or exit!!!
}function(init)
{
lottie($id, "clearplayat", "video") // clear playat
lottie($id, "clear") // MUST clear lottie by id
lottie("start.json", "clearcache") // MUST clear cache by filename
}function(deinit)


Example: Github
https://github.com/arsaframework/examples/tree/master/lottie

Definition in file lottie.h.

Function Documentation

◆ lottie()

int lottie ( const char *  filename,
const char *  command 
)

operations lottie files in json format

Parameters
filenamename of media file want to operator
commandoperator command
Returns
successed return GUID string in load cmd, otherwise is empty string.

Lottie command:
play
pause
stop
isplaying
!isplaying
isend
!isend
clear
load
playat // !!!MUST clear playat with layer name after you done or exit!!!
playatresize // macro -> resize texture same psd layer size and call playat.
loop true, once, pp
once
resize specify width, height after. !!!MUST call before playat cmd!!!
seek
isready
isreadyfirst
fit
getfit
getframe
getframecount
cache
clearplayat // !!!MUST call when not playing on layer or exit.!!!
getfilename
clearcache
getcachecount
getcount
fps // set fps, default is 30
getfps // get current fps



Example: Loading lottie

// load and play lottie file, !!!MUST call clear cmd after done youe job.!!!
set($id, lottie("start.json", "load"))
// [options] load from cloud, direct link only.
set( $id, lottie("https://assets6.lottiefiles.com/packages/lf20_xiussssy.json", "load") )
lottie($id, "clear") // MUST clear lottie when not use anymore. no remove cache, garbage collector will clear all loaded lottie files when program exit.
lottie("null", "clear") // clear lottie all


Example: Cache lottie

set($cid, lottie("start.json", "cache")) // only cache lottie file to memory only, NOT play or load
lottie("start.json", "clearcache") // use lottie filename for clear lottie cache when not use anymore, garbage collector will clear all cached lottie files when program exit.
// lottie("null", "clearcache") // clear cache all


Example: Quality resize lottie render texture

set($id, lottie("start.json", "load")) // load and play lottie file, !!!MUST call clear cmd after done youe job.!!!
lottie($id, "resize", 512, 512) // call resize cmd and send both width and height as parameter after. !!!MUST call before playat cmd!!!


Example: Display lottie on psd layer

set($id, lottie("start.json", "load")) // load and play lottie file, !!!MUST call clear cmd after done youe job.!!!
lottie($id, "playat", "video") // call platat cmd and layername specify that you want show lottie file on it.
// lottie($id, "playatresize", "video") // [optional] resize to same psd size and call platat cmd and layername specify that you want show lottie file on it.
{
lottie($id, "clearplayat", "video") // !!!MUST clear playat with layer name after you done or exit!!!
}function(deinit)


Example: Playback

set($id, lottie("start.json", "load")) // load and play lottie file, !!!MUST call clear cmd after done youe job.!!!
lottie($id, "play") // choose playback cmd, play lottie
lottie($id, "pause") // choose playback cmd, pause lottie
lottie($id, "stop") // choose playback cmd, stop lottie
lottie($id, "loop", "true") // loop lottie
lottie($id, "loop", "true|pp") // loop with pingpong style
lottie($id, "loop", "once") // play one time
lottie($id, "loop", "once|pp") // play one time with pingpong style
lottie($id, "seek", 10) // seek by frame, !!!not exceed framecount!!!
lottie($id, "fps", 60) // change fps to 60 fps
lottie($id, "fit", true) // rendering lottie fit to layer canvas, true or false
lottie($id, "isplaying", function(foo)) // is lottie playing then call foo
lottie($id, "!isplaying", function(foo)) // is lottie stop or pause then call foo
lottie($id, "isend", function(foo)) // is lottie end of file then call foo
lottie($id, "!isend", function(foo)) // is lottie not end of file then call foo
set($ready, lottie($id, "isready") ) // is lottie ready loaded to gpu, true is seccessed, false is now loading
set($readyfirst, lottie($id, "isreadyfirst") ) // is just first time lottie ready loaded to gpu, true is seccessed in first time!, false is now loading
set($fit, lottie($id, "getfit") ) // is lottie rendering lottie fit to layer, return true or false
set($frame, lottie($id, "getframe") ) // get lottie cuttent frame
set($total_frame, lottie($id, "getframecount") ) // get lottie total frame
set($fps, lottie($id, "getfps") ) // get current lottie fps
set($cache_count, lottie($id, "getcachecount") ) // get lottie cache files count
set($lottie_count, lottie($id, "getcount") ) // get lottie files count