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_render_particle_system.h" 24 #include "animation/rs_render_property_animation.h" 25 #include "common/rs_macros.h" 26 27 namespace OHOS { 28 namespace Rosen { 29 class RSB_EXPORT RSRenderParticleAnimation : public RSRenderPropertyAnimation { 30 public: 31 RSRenderParticleAnimation(AnimationId id, const PropertyId& propertyId, 32 const std::vector<std::shared_ptr<ParticleRenderParams>>& particlesRenderParams); 33 34 ~RSRenderParticleAnimation() override = default; 35 RSRenderParticleAnimation() = default; 36 37 void DumpAnimationType(std::string& out) const override; 38 39 bool Marshalling(Parcel& parcel) const override; 40 41 [[nodiscard]] static RSRenderParticleAnimation* Unmarshalling(Parcel& parcel); GetRenderParticle()42 const RSRenderParticleVector& GetRenderParticle() 43 { 44 return renderParticleVector_; 45 } 46 bool Animate(int64_t time) override; 47 48 protected: 49 void OnAttach() override; 50 void OnDetach() override; 51 52 private: 53 bool ParseParam(Parcel& parcel) override; 54 std::vector<std::shared_ptr<ParticleRenderParams>> particlesRenderParams_; 55 std::shared_ptr<RSRenderParticleSystem> particleSystem_; 56 RSRenderParticleVector renderParticleVector_; 57 }; 58 } // namespace Rosen 59 } // namespace OHOS 60 61 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_PARTICLE_ANIMATION_H 62