Skia
2D Graphics Library
skottie::Animation Class Reference

#include <Skottie.h>

Inheritance diagram for skottie::Animation:

Classes

class  Builder
 

Public Types

enum  RenderFlag : uint32_t { kSkipTopLevelIsolation = 0x01 , kDisableTopLevelClipping = 0x02 }
 
using RenderFlags = uint32_t
 

Public Member Functions

 ~Animation ()
 
void render (SkCanvas *canvas, const SkRect *dst=nullptr) const
 Draws the current animation frame. More...
 
void render (SkCanvas *canvas, const SkRect *dst, RenderFlags) const
 
void seek (SkScalar t, sksg::InvalidationController *ic=nullptr)
 [Deprecated: use one of the other versions. More...
 
void seekFrame (double t, sksg::InvalidationController *ic=nullptr)
 Update the animation state to match |t|, specified as a frame index i.e. More...
 
void seekFrameTime (double t, sksg::InvalidationController *=nullptr)
 Update the animation state to match t, specifed in frame time i.e. More...
 
double duration () const
 Returns the animation duration in seconds. More...
 
double fps () const
 Returns the animation frame rate (frames / second). More...
 
double inPoint () const
 Animation in point, in frame index units. More...
 
double outPoint () const
 Animation out point, in frame index units. More...
 
const SkStringversion () const
 
const SkSizesize () const
 
bool unique () const
 
void ref () const
 
void unref () const
 
void deref () const
 
bool refCntGreaterThan (int32_t threadIsolatedTestCnt) const
 

Static Public Member Functions

static sk_sp< AnimationMake (const char *data, size_t length)
 Animation factories. More...
 
static sk_sp< AnimationMake (SkStream *)
 
static sk_sp< AnimationMakeFromFile (const char path[])
 

Member Typedef Documentation

◆ RenderFlags

Member Enumeration Documentation

◆ RenderFlag

Enumerator
kSkipTopLevelIsolation 
kDisableTopLevelClipping 

Constructor & Destructor Documentation

◆ ~Animation()

skottie::Animation::~Animation ( )

Member Function Documentation

◆ deref()

void SkNVRefCnt< Animation >::deref ( ) const
inlineinherited

◆ duration()

double skottie::Animation::duration ( ) const
inline

Returns the animation duration in seconds.

◆ fps()

double skottie::Animation::fps ( ) const
inline

Returns the animation frame rate (frames / second).

◆ inPoint()

double skottie::Animation::inPoint ( ) const
inline

Animation in point, in frame index units.

◆ Make() [1/2]

static sk_sp<Animation> skottie::Animation::Make ( const char *  data,
size_t  length 
)
static

Animation factories.

Use the Builder helper above for more options/control.

◆ Make() [2/2]

static sk_sp<Animation> skottie::Animation::Make ( SkStream )
static

◆ MakeFromFile()

static sk_sp<Animation> skottie::Animation::MakeFromFile ( const char  path[])
static

◆ outPoint()

double skottie::Animation::outPoint ( ) const
inline

Animation out point, in frame index units.

◆ ref()

void SkNVRefCnt< Animation >::ref ( ) const
inlineinherited

◆ refCntGreaterThan()

bool SkNVRefCnt< Animation >::refCntGreaterThan ( int32_t  threadIsolatedTestCnt) const
inlineinherited

◆ render() [1/2]

void skottie::Animation::render ( SkCanvas canvas,
const SkRect dst,
RenderFlags   
) const

◆ render() [2/2]

void skottie::Animation::render ( SkCanvas canvas,
const SkRect dst = nullptr 
) const

Draws the current animation frame.

It is undefined behavior to call render() on a newly created Animation before specifying an initial frame via one of the seek() variants.

Parameters
canvasdestination canvas
dstoptional destination rect
flagsoptional RenderFlags

◆ seek()

void skottie::Animation::seek ( SkScalar  t,
sksg::InvalidationController ic = nullptr 
)
inline

[Deprecated: use one of the other versions.

]

Updates the animation state for |t|.

Parameters
tnormalized [0..1] frame selector (0 -> first frame, 1 -> final frame)
icoptional invalidation controller (dirty region tracking)

◆ seekFrame()

void skottie::Animation::seekFrame ( double  t,
sksg::InvalidationController ic = nullptr 
)

Update the animation state to match |t|, specified as a frame index i.e.

relative to duration() * fps().

Fractional values are allowed and meaningful - e.g.

0.0 -> first frame 1.0 -> second frame 0.5 -> halfway between first and second frame

◆ seekFrameTime()

void skottie::Animation::seekFrameTime ( double  t,
sksg::InvalidationController = nullptr 
)

Update the animation state to match t, specifed in frame time i.e.

relative to duration().

◆ size()

const SkSize& skottie::Animation::size ( ) const
inline

◆ unique()

bool SkNVRefCnt< Animation >::unique ( ) const
inlineinherited

◆ unref()

void SkNVRefCnt< Animation >::unref ( ) const
inlineinherited

◆ version()

const SkString& skottie::Animation::version ( ) const
inline

The documentation for this class was generated from the following file: