Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkottieCubeSlide Class Reference
Inheritance diagram for SkottieCubeSlide:
CubeBaseSlide ThreeDSlide ClickHandlerSlide Slide SkRefCnt SkRefCntBase

Public Member Functions

 SkottieCubeSlide ()
 
void load (SkScalar w, SkScalar h) override
 
void drawFace (SkCanvas *canvas, SkColor color, int face, bool front, const SkM44 &) override
 
bool animate (double nanos) override
 
- Public Member Functions inherited from CubeBaseSlide
 CubeBaseSlide (Flags flags)
 
bool onChar (SkUnichar uni) override
 
void draw (SkCanvas *canvas) override
 
ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi) override
 
bool onClick (Click *click) override
 
- Public Member Functions inherited from ThreeDSlide
void concatCamera (SkCanvas *canvas, const SkRect &area, SkScalar zscale)
 
- Public Member Functions inherited from ClickHandlerSlide
bool onMouse (SkScalar x, SkScalar y, skui::InputState clickState, skui::ModifierKey modifierKeys) final
 
- Public Member Functions inherited from Slide
virtual SkISize getDimensions () const
 
virtual void gpuTeardown ()
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onGetControls (SkMetaData *)
 
virtual void onSetControls (const SkMetaData &)
 
const SkStringgetName ()
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Additional Inherited Members

- Protected Types inherited from CubeBaseSlide
enum  Flags { kCanRunOnCPU = 1 << 0 , kShowLightDome = 1 << 1 }
 
- Protected Attributes inherited from CubeBaseSlide
LightOnSphere fLight = {{200 + DX, 200 + DY}, 800, 12}
 
VSphere fSphere
 
Flags fFlags
 
- Protected Attributes inherited from ThreeDSlide
float fNear = 0.05f
 
float fFar = 4
 
float fAngle = SK_ScalarPI / 12
 
SkV3 fEye { 0, 0, 1.0f/std::tan(fAngle/2) - 1 }
 
SkV3 fCOA { 0, 0, 0 }
 
SkV3 fUp { 0, 1, 0 }
 
- Protected Attributes inherited from Slide
SkString fName
 

Detailed Description

Definition at line 433 of file 3DSlide.cpp.

Constructor & Destructor Documentation

◆ SkottieCubeSlide()

SkottieCubeSlide::SkottieCubeSlide ( )
inline

Definition at line 437 of file 3DSlide.cpp.

437: CubeBaseSlide(kCanRunOnCPU) { fName = "skottie3d"; }
const char * fName

Member Function Documentation

◆ animate()

bool SkottieCubeSlide::animate ( double  nanos)
inlineoverridevirtual

Reimplemented from CubeBaseSlide.

Definition at line 468 of file 3DSlide.cpp.

468 {
469 for (auto& anim : fAnim) {
470 SkScalar dur = anim->duration();
471 SkScalar t = fmod(1e-9 * nanos, dur) / dur;
472 anim->seek(t);
473 }
474 return true;
475 }
float SkScalar
Definition extension.cpp:12

◆ drawFace()

void SkottieCubeSlide::drawFace ( SkCanvas canvas,
SkColor  color,
int  face,
bool  front,
const SkM44  
)
inlineoverridevirtual

Implements CubeBaseSlide.

Definition at line 456 of file 3DSlide.cpp.

456 {
457 if (!front || !isFrontFacing(canvas->getLocalToDevice())) {
458 return;
459 }
460
462 paint.setColor(color);
463 SkRect r = {0, 0, 400, 400};
464 canvas->drawRect(r, paint);
465 fAnim[face]->render(canvas, &r);
466 }
static bool isFrontFacing(const SkM44 &m)
Definition 3DSlide.cpp:123
SkColor4f color
void drawRect(const SkRect &rect, const SkPaint &paint)
SkM44 getLocalToDevice() const
void render(SkCanvas *canvas, const SkRect *dst=nullptr) const
Definition Skottie.cpp:482
const Paint & paint

◆ load()

void SkottieCubeSlide::load ( SkScalar  w,
SkScalar  h 
)
inlineoverridevirtual

Reimplemented from Slide.

Definition at line 439 of file 3DSlide.cpp.

439 {
440 const char* files[] = {
441 "skottie/skottie-chained-mattes.json",
442 "skottie/skottie-gradient-ramp.json",
443 "skottie/skottie_sample_2.json",
444 "skottie/skottie-3d-3planes.json",
445 "skottie/skottie-text-animator-4.json",
446 "skottie/skottie-motiontile-effect-phase.json",
447
448 };
449 for (unsigned i = 0; i < std::size(files); ++i) {
450 if (auto stream = GetResourceAsStream(files[i])) {
451 fAnim[i] = skottie::Animation::Make(stream.get());
452 }
453 }
454 }
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
Definition Resources.cpp:31
static sk_sp< Animation > Make(const char *data, size_t length)
Definition Skottie.cpp:534

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