summaryrefslogtreecommitdiff
path: root/animations
diff options
context:
space:
mode:
authorSarper Akdemir <q.sarperakdemir@gmail.com>2020-08-14 01:18:14 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-08-22 11:24:16 +0200
commit394f74e6f168f034f7ed73e3027e4ff07f6b94b9 (patch)
treeb4da98e1d95e6bd3bf0e0a1cf30a9a5769907dc3 /animations
parent8a360d04e43410e729c0ee270be5447ce6c1cd03 (diff)
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 <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'animations')
-rw-r--r--animations/source/animcore/animcore.cxx87
1 files changed, 84 insertions, 3 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 88e42772936a..107353cf327a 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/animations/XAnimateColor.hpp>
#include <com/sun/star/animations/XAnimateSet.hpp>
#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimatePhysics.hpp>
#include <com/sun/star/animations/XAnimateTransform.hpp>
#include <com/sun/star/animations/XParallelTimeContainer.hpp>
#include <com/sun/star/animations/XTransitionFilter.hpp>
@@ -104,6 +105,7 @@ namespace animcore
namespace {
class AnimationNodeBase : public XAnimateMotion,
+ public XAnimatePhysics,
public XAnimateColor,
public XTransitionFilter,
public XAnimateSet,
@@ -224,6 +226,16 @@ public:
virtual Any SAL_CALL getOrigin() override;
virtual void SAL_CALL setOrigin( const Any& _origin ) override;
+ // XAnimatePhysics
+ virtual Any SAL_CALL getStartVelocityX() override;
+ virtual void SAL_CALL setStartVelocityX( const Any& _startvelocityx ) override;
+ virtual Any SAL_CALL getStartVelocityY() override;
+ virtual void SAL_CALL setStartVelocityY( const Any& _startvelocityy ) override;
+ virtual Any SAL_CALL getDensity() override;
+ virtual void SAL_CALL setDensity( const Any& _density ) override;
+ virtual Any SAL_CALL getBounciness() override;
+ virtual void SAL_CALL setBounciness( const Any& _bounciness ) override;
+
// XAnimateTransform
virtual sal_Int16 SAL_CALL getTransformType() override;
virtual void SAL_CALL setTransformType( sal_Int16 _transformtype ) override;
@@ -322,6 +334,9 @@ private:
// attributes for XAnimateMotion
Any maPath, maOrigin;
+ // attributes for XAnimatePhysics
+ Any maStartVelocityX, maStartVelocityY, maDensity, maBounciness;
+
// attributes for XAnimateTransform
sal_Int16 mnTransformType;
@@ -671,8 +686,8 @@ Any SAL_CALL AnimationNode::queryInterface( const Type& aType )
case AnimationNodeType::ANIMATEPHYSICS:
aRet = ::cppu::queryInterface(
aType,
- static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ),
- static_cast< XAnimateMotion * >( this ) );
+ static_cast< XAnimate * >( static_cast< XAnimatePhysics * >(this) ),
+ static_cast< XAnimatePhysics * >( this ) );
break;
case AnimationNodeType::ANIMATECOLOR:
aRet = ::cppu::queryInterface(
@@ -767,7 +782,7 @@ void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw()
pTypeAr[nPos++] = cppu::UnoType<XAnimateMotion>::get();
break;
case AnimationNodeType::ANIMATEPHYSICS:
- pTypeAr[nPos++] = cppu::UnoType<XAnimateMotion>::get();
+ pTypeAr[nPos++] = cppu::UnoType<XAnimatePhysics>::get();
break;
case AnimationNodeType::ANIMATECOLOR:
pTypeAr[nPos++] = cppu::UnoType<XAnimateColor>::get();
@@ -1584,6 +1599,72 @@ void SAL_CALL AnimationNode::setOrigin( const Any& _origin )
fireChangeListener();
}
+// XAnimatePhysics
+Any SAL_CALL AnimationNode::getStartVelocityX()
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maStartVelocityX;
+}
+
+
+// XAnimatePhysics
+void SAL_CALL AnimationNode::setStartVelocityX( const Any& _startvelocityx )
+{
+ Guard< Mutex > aGuard( maMutex );
+ maStartVelocityX = _startvelocityx;
+ fireChangeListener();
+}
+
+// XAnimatePhysics
+Any SAL_CALL AnimationNode::getStartVelocityY()
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maStartVelocityY;
+}
+
+
+// XAnimatePhysics
+void SAL_CALL AnimationNode::setStartVelocityY( const Any& _startvelocityy )
+{
+ Guard< Mutex > aGuard( maMutex );
+ maStartVelocityY = _startvelocityy;
+ fireChangeListener();
+}
+
+
+// XAnimatePhysics
+Any SAL_CALL AnimationNode::getDensity()
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maDensity;
+}
+
+
+// XAnimatePhysics
+void SAL_CALL AnimationNode::setDensity( const Any& _density )
+{
+ Guard< Mutex > aGuard( maMutex );
+ maDensity = _density;
+ fireChangeListener();
+}
+
+
+// XAnimatePhysics
+Any SAL_CALL AnimationNode::getBounciness()
+{
+ Guard< Mutex > aGuard( maMutex );
+ return maBounciness;
+}
+
+
+// XAnimatePhysics
+void SAL_CALL AnimationNode::setBounciness( const Any& _bounciness )
+{
+ Guard< Mutex > aGuard( maMutex );
+ maBounciness = _bounciness;
+ fireChangeListener();
+}
+
// XAnimateTransform
sal_Int16 SAL_CALL AnimationNode::getTransformType()