38 static constexpr auto kMidX = 35;
39 static constexpr auto kMidY = 50;
42 for (
int i = 0;
i < kNumChars; ++
i) {
44 double rot =
SkScalarInterp(fChars[
i].fStartRotation, fChars[
i].fEndRotation,
46 canvas->
translate(fChars[
i].fPosition.fX + kMidX, fChars[
i].fPosition.fY - kMidY);
55 fCurrTime = 1
e-9 * nanos - fResetTime;
56 if (fCurrTime > kDuration) {
58 fResetTime = 1
e-9 * nanos;
67 for (
int i = 0;
i < kNumChars; ++
i) {
69 fChars[
i].fChar[0] = c;
70 fChars[
i].fChar[1] =
'\0';
72 fChars[
i].fStartRotation = fRand.
nextF();
73 fChars[
i].fEndRotation = fRand.
nextF() * 20 - 10;
77 inline static constexpr double kDuration = 5.0;
89 inline static constexpr int kNumChars = 40;
90 AnimatedChar fChars[kNumChars];
constexpr SkColor SK_ColorWHITE
#define SkRadiansToDegrees(radians)
static SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t)
void draw(SkCanvas *canvas) override
void load(SkScalar w, SkScalar h) override
bool animate(double nanos) override
void translate(SkScalar dx, SkScalar dy)
void clear(SkColor color)
void rotate(SkScalar degrees)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
sk_sp< SkTypeface > makeFromFile(const char path[], int ttcIndex=0) const
uint32_t nextULessThan(uint32_t count)
font
Font Metadata and Metrics.
static constexpr SkPoint Make(float x, float y)