• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_ANIMATION_H
17 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_ANIMATION_H
18 
19 #include <memory>
20 
21 #include "rs_render_particle.h"
22 
23 #include "animation/rs_interpolator.h"
24 #include "animation/rs_render_particle_system.h"
25 #include "animation/rs_render_property_animation.h"
26 #include "common/rs_macros.h"
27 
28 namespace OHOS {
29 namespace Rosen {
30 class RSB_EXPORT RSRenderParticleAnimation : public RSRenderPropertyAnimation {
31 public:
32     RSRenderParticleAnimation(AnimationId id, const PropertyId& propertyId,
33         const std::vector<std::shared_ptr<ParticleRenderParams>> particlesRenderParams);
34 
35     virtual ~RSRenderParticleAnimation() = default;
36     RSRenderParticleAnimation() = default;
37 
38     bool Marshalling(Parcel& parcel) const override;
39 
40     [[nodiscard]] static RSRenderParticleAnimation* Unmarshalling(Parcel& parcel);
GetRenderParticle()41     RSRenderParticleVector GetRenderParticle()
42     {
43         return renderParticleVector_;
44     }
45 
46 protected:
47     bool Animate(int64_t time) override;
48     void OnAttach() override;
49     void OnDetach() override;
50 
51 private:
52     bool ParseParam(Parcel& parcel) override;
53     std::shared_ptr<RSRenderParticleSystem> particleSystem_;
54     std::vector<std::shared_ptr<ParticleRenderParams>> particlesRenderParams_;
55     RSRenderParticleVector renderParticleVector_;
56 };
57 } // namespace Rosen
58 } // namespace OHOS
59 
60 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_ANIMATION_H
61