5c1f8eb094
Effects now have a duration, and can be played looped or one-shot. Added a second list of affectors that are applied at spawn vs. update. Effects grab and store the SkRandom at construction, so it no longer needs to be passed to update(). Bug: skia: Change-Id: Ib54d60466e162e4d4b70fa64c1215fc01680d47a Reviewed-on: https://skia-review.googlesource.com/c/191722 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Michael Ludwig <michaelludwig@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
40 lines
944 B
C++
40 lines
944 B
C++
/*
|
|
* Copyright 2019 Google LLC
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef ParticlesSlide_DEFINED
|
|
#define ParticlesSlide_DEFINED
|
|
|
|
#include "Slide.h"
|
|
|
|
#include "SkPath.h"
|
|
#include "SkRandom.h"
|
|
|
|
class SkAnimTimer;
|
|
class SkParticleEffect;
|
|
|
|
class ParticlesSlide : public Slide {
|
|
public:
|
|
ParticlesSlide();
|
|
|
|
// TODO: We need a way for primarily interactive slides to always be as large as the window
|
|
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
void draw(SkCanvas* canvas) override;
|
|
bool animate(const SkAnimTimer& timer) override;
|
|
|
|
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState state,
|
|
uint32_t modifiers) override;
|
|
|
|
private:
|
|
SkRandom fRandom;
|
|
const SkAnimTimer* fTimer;
|
|
sk_sp<SkParticleEffect> fEffect;
|
|
};
|
|
|
|
#endif
|