#include <dali/internal/event/effects/shader-effect-impl.h>
#include <dali/internal/event/common/thread-local-storage.h>
-using namespace std;
-
using Dali::Internal::SceneGraph::UpdateManager;
using Dali::Internal::SceneGraph::AnimatorBase;
using Dali::Internal::SceneGraph::Shader;
const Dali::Animation::EndAction DEFAULT_END_ACTION( Dali::Animation::Bake );
const Dali::Animation::EndAction DEFAULT_DISCONNECT_ACTION( Dali::Animation::BakeFinal );
+const Dali::Animation::Interpolation DEFAULT_INTERPOLATION( Dali::Animation::Linear );
} // anon namespace
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames)
{
- AnimateBetween(target, keyFrames, mDefaultAlpha, mDurationSeconds);
+ AnimateBetween(target, keyFrames, mDefaultAlpha, mDurationSeconds, DEFAULT_INTERPOLATION );
+}
+
+void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, Interpolation interpolation )
+{
+ AnimateBetween(target, keyFrames, mDefaultAlpha, mDurationSeconds, interpolation );
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period)
{
- AnimateBetween(target, keyFrames, mDefaultAlpha, period);
+ AnimateBetween(target, keyFrames, mDefaultAlpha, period, DEFAULT_INTERPOLATION);
+}
+
+void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, TimePeriod period, Interpolation interpolation)
+{
+ AnimateBetween(target, keyFrames, mDefaultAlpha, period, interpolation);
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha)
{
- AnimateBetween(target, keyFrames, alpha, mDurationSeconds);
+ AnimateBetween(target, keyFrames, alpha, mDurationSeconds, DEFAULT_INTERPOLATION);
+}
+
+void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, Interpolation interpolation)
+{
+ AnimateBetween(target, keyFrames, alpha, mDurationSeconds, interpolation);
}
void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period)
{
+ AnimateBetween(target, keyFrames, alpha, period, DEFAULT_INTERPOLATION);
+}
+
+void Animation::AnimateBetween(Property target, const KeyFrames& keyFrames, AlphaFunction alpha, TimePeriod period, Interpolation interpolation)
+{
ProxyObject& proxy = dynamic_cast<ProxyObject&>( GetImplementation(target.object) );
ExtendDuration( period );
AddAnimatorConnector( AnimatorConnector<float>::New( proxy,
target.propertyIndex,
target.componentIndex,
- KeyFrameNumberFunctor(kfCopy),
+ KeyFrameNumberFunctor(kfCopy,interpolation),
alpha,
period ) );
break;
AddAnimatorConnector( AnimatorConnector<int>::New( proxy,
target.propertyIndex,
target.componentIndex,
- KeyFrameIntegerFunctor(kfCopy),
+ KeyFrameIntegerFunctor(kfCopy,interpolation),
alpha,
period ) );
break;
AddAnimatorConnector( AnimatorConnector<Vector2>::New( proxy,
target.propertyIndex,
target.componentIndex,
- KeyFrameVector2Functor(kfCopy),
+ KeyFrameVector2Functor(kfCopy,interpolation),
alpha,
period ) );
break;
AddAnimatorConnector( AnimatorConnector<Vector3>::New( proxy,
target.propertyIndex,
target.componentIndex,
- KeyFrameVector3Functor(kfCopy),
+ KeyFrameVector3Functor(kfCopy,interpolation),
alpha,
period ) );
break;
AddAnimatorConnector( AnimatorConnector<Vector4>::New( proxy,
target.propertyIndex,
target.componentIndex,
- KeyFrameVector4Functor(kfCopy),
+ KeyFrameVector4Functor(kfCopy,interpolation),
alpha,
period ) );
break;
mConnectors.PushBack( connector );
}
+void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward )
+{
+ Animate( actor, path, forward, mDefaultAlpha, TimePeriod(0.0f,GetDuration()) );
+}
+
+void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha )
+{
+ Animate( actor, path, forward, alpha, TimePeriod(0.0f,GetDuration()) );
+}
+
+void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward, TimePeriod period )
+{
+ Animate( actor, path, forward, mDefaultAlpha, period );
+}
+
+void Animation::Animate( Actor& actor, const Path& path, const Vector3& forward, AlphaFunction alpha, TimePeriod period)
+{
+ ExtendDuration( period );
+
+ PathPtr pathCopy = Path::Clone(path);
+
+ //Position animation
+ AddAnimatorConnector( AnimatorConnector<Vector3>::New( actor,
+ Dali::Actor::POSITION,
+ Property::INVALID_COMPONENT_INDEX,
+ PathPositionFunctor( pathCopy ),
+ alpha,
+ period ) );
+
+ //If forward is zero, PathRotationFunctor will always return the unit quaternion
+ if( forward != Vector3::ZERO )
+ {
+ //Rotation animation
+ AddAnimatorConnector( AnimatorConnector<Quaternion>::New( actor,
+ Dali::Actor::ROTATION,
+ Property::INVALID_COMPONENT_INDEX,
+ PathRotationFunctor( pathCopy, forward ),
+ alpha,
+ period ) );
+ }
+}
+
void Animation::MoveBy(Actor& actor, float x, float y, float z)
{
MoveBy(actor, Vector3(x, y, z), mDefaultAlpha, 0.0f, GetDuration());
void Animation::Resize(Actor& actor, float width, float height, AlphaFunction alpha, float delaySeconds, float durationSeconds)
{
- Vector3 targetSize( width, height, min(width, height) );
+ Vector3 targetSize( width, height, std::min(width, height) );
ExtendDuration( TimePeriod(delaySeconds, durationSeconds) );