From 394f74e6f168f034f7ed73e3027e4ff07f6b94b9 Mon Sep 17 00:00:00 2001 From: Sarper Akdemir Date: Fri, 14 Aug 2020 01:18:14 +0300 Subject: add bounciness velocity and density options to physics animations Adding new xml options to specify the starting velocity, bounciness, and density of the rigid body that physics animation control. Change-Id: Ifaba785e82c8ee17be00711a3e7a75257e7704ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101141 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- slideshow/source/inc/animationfactory.hxx | 3 +++ slideshow/source/inc/box2dtools.hxx | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'slideshow/source/inc') diff --git a/slideshow/source/inc/animationfactory.hxx b/slideshow/source/inc/animationfactory.hxx index af3b9b9a4e49..3004c71308a9 100644 --- a/slideshow/source/inc/animationfactory.hxx +++ b/slideshow/source/inc/animationfactory.hxx @@ -137,6 +137,9 @@ namespace slideshow::internal const double fDuration, const ShapeManagerSharedPtr& rShapeManager, const ::basegfx::B2DVector& rSlideSize, + const ::basegfx::B2DVector& rStartVelocity, + const double fDensity, + const double fBounciness, int nFlags ); } diff --git a/slideshow/source/inc/box2dtools.hxx b/slideshow/source/inc/box2dtools.hxx index 08b0f4b557cf..0debf1da4ef0 100644 --- a/slideshow/source/inc/box2dtools.hxx +++ b/slideshow/source/inc/box2dtools.hxx @@ -221,7 +221,9 @@ public: @param pShape Pointer to the shape to alter the corresponding Box2D body of */ - Box2DBodySharedPtr makeShapeDynamic(const slideshow::internal::ShapeSharedPtr& pShape); + Box2DBodySharedPtr makeShapeDynamic(const css::uno::Reference& xShape, + const basegfx::B2DVector& rStartVelocity, + const double fDensity, const double fBounciness); /** Make the Box2D body corresponding to the given shape a static one @@ -267,6 +269,8 @@ public: void queueShapeAnimationEndUpdate(const css::uno::Reference& xShape, const slideshow::internal::AttributeType eAttrType); + + void alertAnimationEndForShape(const slideshow::internal::ShapeSharedPtr& pShape); }; /// Class that manages a single box2D Body @@ -327,6 +331,10 @@ public: void setAngle(const double fAngle); + void setDensityAndRestitution(const double fDensity, const double fRestitution); + + void setRestitution(const double fRestitution); + /// Set type of the body void setType(box2DBodyType eType); -- cgit