summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/animationnodes
diff options
context:
space:
mode:
authorSarper Akdemir <q.sarperakdemir@gmail.com>2020-06-11 19:29:38 +0300
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-08-09 23:44:00 +0200
commit28022cee396715bc4b474ed1571074dc721bbe13 (patch)
tree98918b687f2ebddc979083771c4614f9e7f44f7f /slideshow/source/engine/animationnodes
parent6ce2eddfdc35100b8079a4584dd3945e923d66a9 (diff)
make physics based animation effects part of the animation engine
Wiring up and creating required classes for physics based animation effects to be part of the animation engine. Creating a new animation node AnimationPhysicsNode for physics based animation effects and PhysicsAnimation class that inherits the NumberAnimation in the animation factory. Change-Id: I1f125df5324673e9937b8164c0fc267c9683afa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100151 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'slideshow/source/engine/animationnodes')
-rw-r--r--slideshow/source/engine/animationnodes/animationcolornode.cxx6
-rw-r--r--slideshow/source/engine/animationnodes/animationnodefactory.cxx6
-rw-r--r--slideshow/source/engine/animationnodes/animationpathmotionnode.cxx3
-rw-r--r--slideshow/source/engine/animationnodes/animationphysicsnode.cxx48
-rw-r--r--slideshow/source/engine/animationnodes/animationphysicsnode.hxx54
-rw-r--r--slideshow/source/engine/animationnodes/animationsetnode.cxx5
-rw-r--r--slideshow/source/engine/animationnodes/animationtransformnode.cxx9
-rw-r--r--slideshow/source/engine/animationnodes/propertyanimationnode.cxx15
8 files changed, 135 insertions, 11 deletions
diff --git a/slideshow/source/engine/animationnodes/animationcolornode.cxx b/slideshow/source/engine/animationnodes/animationcolornode.cxx
index 39ca961c478f..14a32aae4af9 100644
--- a/slideshow/source/engine/animationnodes/animationcolornode.cxx
+++ b/slideshow/source/engine/animationnodes/animationcolornode.cxx
@@ -91,7 +91,8 @@ AnimationActivitySharedPtr AnimationColorNode::createActivity() const
mxColorNode->getAttributeName(),
getShape(),
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
getXAnimateNode() );
case animations::AnimationColorSpace::HSL:
@@ -105,7 +106,8 @@ AnimationActivitySharedPtr AnimationColorNode::createActivity() const
mxColorNode->getAttributeName(),
getShape(),
getContext().mpSubsettableShapeManager,
- getSlideSize() )),
+ getSlideSize(),
+ getContext().mpBox2DWorld )),
mxColorNode );
default:
diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
index f9fa01b2f1fd..4df097cb08c0 100644
--- a/slideshow/source/engine/animationnodes/animationnodefactory.cxx
+++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
@@ -33,6 +33,7 @@
#include "propertyanimationnode.hxx"
#include "animationsetnode.hxx"
#include "animationpathmotionnode.hxx"
+#include "animationphysicsnode.hxx"
#include "animationcolornode.hxx"
#include "animationtransformnode.hxx"
#include "animationtransitionfilternode.hxx"
@@ -493,6 +494,11 @@ BaseNodeSharedPtr implCreateAnimationNode(
xNode, rParent, rContext );
break;
+ case animations::AnimationNodeType::ANIMATEPHYSICS:
+ pCreatedNode = std::make_shared<AnimationPhysicsNode>(
+ xNode, rParent, rContext );
+ break;
+
case animations::AnimationNodeType::TRANSITIONFILTER:
pCreatedNode = std::make_shared<AnimationTransitionFilterNode>(
xNode, rParent, rContext );
diff --git a/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx b/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx
index 2490b6e2cbc8..cbef1f3eabba 100644
--- a/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx
@@ -43,7 +43,8 @@ AnimationActivitySharedPtr AnimationPathMotionNode::createActivity() const
mxPathMotionNode->getAdditive(),
getShape(),
getContext().mpSubsettableShapeManager,
- getSlideSize(), 0 ),
+ getSlideSize(),
+ getContext().mpBox2DWorld, 0 ),
true );
}
diff --git a/slideshow/source/engine/animationnodes/animationphysicsnode.cxx b/slideshow/source/engine/animationnodes/animationphysicsnode.cxx
new file mode 100644
index 000000000000..28e247c30d6c
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationphysicsnode.cxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "animationphysicsnode.hxx"
+#include <animationfactory.hxx>
+
+namespace slideshow::internal
+{
+void AnimationPhysicsNode::dispose()
+{
+ mxPhysicsMotionNode.clear();
+ AnimationBaseNode::dispose();
+}
+
+AnimationActivitySharedPtr AnimationPhysicsNode::createActivity() const
+{
+ double fDuration;
+ ENSURE_OR_THROW((mxPhysicsMotionNode->getDuration() >>= fDuration),
+ "Couldn't get the animation duration.");
+
+ ActivitiesFactory::CommonParameters const aParms(fillCommonParameters());
+ return ActivitiesFactory::createSimpleActivity(
+ aParms,
+ AnimationFactory::createPhysicsAnimation(getContext().mpBox2DWorld, fDuration,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(), 0),
+ true);
+}
+
+} // namespace slideshow::internal
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/animationnodes/animationphysicsnode.hxx b/slideshow/source/engine/animationnodes/animationphysicsnode.hxx
new file mode 100644
index 000000000000..15ac8911e916
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationphysicsnode.hxx
@@ -0,0 +1,54 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#pragma once
+
+#include "animationbasenode.hxx"
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+
+namespace slideshow
+{
+namespace internal
+{
+class AnimationPhysicsNode : public AnimationBaseNode
+{
+public:
+ AnimationPhysicsNode(const css::uno::Reference<css::animations::XAnimationNode>& xNode,
+ const BaseContainerNodeSharedPtr& rParent, const NodeContext& rContext)
+ : AnimationBaseNode(xNode, rParent, rContext)
+ , mxPhysicsMotionNode(xNode, css::uno::UNO_QUERY_THROW)
+ {
+ }
+
+#if defined(DBG_UTIL)
+ virtual const char* getDescription() const override { return "AnimationPhysicsNode"; }
+#endif
+
+protected:
+ virtual void dispose() override;
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const override;
+
+ css::uno::Reference<css::animations::XAnimateMotion> mxPhysicsMotionNode;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/slideshow/source/engine/animationnodes/animationsetnode.cxx b/slideshow/source/engine/animationnodes/animationsetnode.cxx
index 350e80fbcfe7..89747901e73c 100644
--- a/slideshow/source/engine/animationnodes/animationsetnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationsetnode.cxx
@@ -86,6 +86,7 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pShape,
getContext().mpSubsettableShapeManager,
getSlideSize(),
+ getContext().mpBox2DWorld,
AnimationFactory::FLAG_NO_SPRITE ),
aValue );
}
@@ -109,6 +110,7 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pShape,
getContext().mpSubsettableShapeManager,
getSlideSize(),
+ getContext().mpBox2DWorld,
AnimationFactory::FLAG_NO_SPRITE ),
aValue );
}
@@ -132,6 +134,7 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pShape,
getContext().mpSubsettableShapeManager,
getSlideSize(),
+ getContext().mpBox2DWorld,
AnimationFactory::FLAG_NO_SPRITE ),
aValue );
}
@@ -155,6 +158,7 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pShape,
getContext().mpSubsettableShapeManager,
getSlideSize(),
+ getContext().mpBox2DWorld,
AnimationFactory::FLAG_NO_SPRITE ),
aValue );
}
@@ -178,6 +182,7 @@ AnimationActivitySharedPtr AnimationSetNode::createActivity() const
pShape,
getContext().mpSubsettableShapeManager,
getSlideSize(),
+ getContext().mpBox2DWorld,
AnimationFactory::FLAG_NO_SPRITE ),
aValue );
}
diff --git a/slideshow/source/engine/animationnodes/animationtransformnode.cxx b/slideshow/source/engine/animationnodes/animationtransformnode.cxx
index b8019d77e6a1..624bad401e8b 100644
--- a/slideshow/source/engine/animationnodes/animationtransformnode.cxx
+++ b/slideshow/source/engine/animationnodes/animationtransformnode.cxx
@@ -67,7 +67,8 @@ AnimationActivitySharedPtr AnimationTransformNode::createActivity() const
"Rotate",
rShape,
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
getXAnimateNode() );
case animations::AnimationTransformType::SKEWX:
@@ -77,7 +78,8 @@ AnimationActivitySharedPtr AnimationTransformNode::createActivity() const
"SkewX",
rShape,
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
getXAnimateNode() );
case animations::AnimationTransformType::SKEWY:
@@ -87,7 +89,8 @@ AnimationActivitySharedPtr AnimationTransformNode::createActivity() const
"SkewY",
rShape,
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
getXAnimateNode() );
}
}
diff --git a/slideshow/source/engine/animationnodes/propertyanimationnode.cxx b/slideshow/source/engine/animationnodes/propertyanimationnode.cxx
index 2643c44036d8..3e7d68b4beb7 100644
--- a/slideshow/source/engine/animationnodes/propertyanimationnode.cxx
+++ b/slideshow/source/engine/animationnodes/propertyanimationnode.cxx
@@ -48,7 +48,8 @@ AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
attrName,
pShape,
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
xAnimateNode );
case AnimationFactory::CLASS_ENUM_PROPERTY:
@@ -58,7 +59,8 @@ AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
attrName,
pShape,
getContext().mpSubsettableShapeManager,
- getSlideSize(), 0 ),
+ getSlideSize(),
+ getContext().mpBox2DWorld, 0 ),
xAnimateNode );
case AnimationFactory::CLASS_COLOR_PROPERTY:
@@ -68,7 +70,8 @@ AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
attrName,
pShape,
getContext().mpSubsettableShapeManager,
- getSlideSize() ),
+ getSlideSize(),
+ getContext().mpBox2DWorld ),
xAnimateNode );
case AnimationFactory::CLASS_STRING_PROPERTY:
@@ -78,7 +81,8 @@ AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
attrName,
pShape,
getContext().mpSubsettableShapeManager,
- getSlideSize(), 0 ),
+ getSlideSize(),
+ getContext().mpBox2DWorld, 0 ),
xAnimateNode );
case AnimationFactory::CLASS_BOOL_PROPERTY:
@@ -88,7 +92,8 @@ AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
attrName,
pShape,
getContext().mpSubsettableShapeManager,
- getSlideSize(), 0 ),
+ getSlideSize(),
+ getContext().mpBox2DWorld, 0 ),
xAnimateNode );
}