Flutter Engine
The Flutter Engine
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
 
virtual void drawFace (SkCanvas *, SkColor, int face, bool front, const SkM44 &localToWorld)=0
 
void draw (SkCanvas *canvas) override
 
ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi) override
 
bool onClick (Click *click) override
 
bool animate (double nanos) 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 draw (SkCanvas *canvas)=0
 
virtual bool animate (double nanos)
 
virtual void load (SkScalar winWidth, SkScalar winHeight)
 
virtual void resize (SkScalar winWidth, SkScalar winHeight)
 
virtual void unload ()
 
virtual bool onChar (SkUnichar c)
 
virtual bool onMouse (SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
 
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 }
 
virtual ClickonFindClickHandler (SkScalar x, SkScalar y, skui::ModifierKey modi)=0
 
virtual bool onClick (Click *)=0
 
- 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"; }
CubeBaseSlide(Flags flags)
Definition: 3DSlide.cpp:256
SkString fName
Definition: Slide.h:54

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
void drawRect(const SkRect &rect, const SkPaint &paint)
Definition: SkCanvas.cpp:1673
SkM44 getLocalToDevice() const
Definition: SkCanvas.cpp:1633
void render(SkCanvas *canvas, const SkRect *dst=nullptr) const
Definition: Skottie.cpp:482
const Paint & paint
Definition: color_source.cc:38
DlColor color

◆ 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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259

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