Definition at line 24 of file AnimatedRectsSlide.cpp.
◆ AnimatedRects()
AnimatedRects::AnimatedRects |
( |
| ) |
|
|
inline |
◆ animate()
bool AnimatedRects::animate |
( |
double |
nanos | ) |
|
|
inlineoverrideprotectedvirtual |
Reimplemented from Slide.
Definition at line 59 of file AnimatedRectsSlide.cpp.
59 {
60 float seconds = 1
e-9 * nanos;
61 if (0.0f != fLastTime) {
62 float scale = (seconds - fLastTime) * 60;
63
65 AnimatedRect& r = fRect[
i];
66 r.x -= r.speed *
scale;
67 if (r.x + r.size < 0) {
69 }
70 }
71 }
72
73 fLastTime = seconds;
74 return true;
75 }
static constexpr int kNumRects
◆ draw()
void AnimatedRects::draw |
( |
SkCanvas * |
canvas | ) |
|
|
inlineoverrideprotectedvirtual |
Implements Slide.
Definition at line 48 of file AnimatedRectsSlide.cpp.
48 {
51
53 const AnimatedRect& r = fRect[
i];
54 canvas->
drawRect(
SkRect{r.
x, r.y, r.x + r.size, r.y + r.size}, fStrokePaint);
55 canvas->
drawRect(
SkRect{r.
x, r.y, r.x + r.size, r.y + r.size}, fFillPaint);
56 }
57 }
void drawRect(const SkRect &rect, const SkPaint &paint)
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
constexpr float x() const
◆ load()
|
inlineoverrideprotectedvirtual |
Reimplemented from Slide.
Definition at line 31 of file AnimatedRectsSlide.cpp.
31 {
35 fRect[
i].size = 10.0 + fRand.
nextF() * 40.0;
36 fRect[
i].speed = 1.0 + fRand.
nextF();
37 }
38
46 }
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorWHITE
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
@ kFill_Style
set to fill geometry
void setStrokeWidth(SkScalar width)
The documentation for this class was generated from the following file: