path animation always not equals

Signed-off-by: sunfei <sunfei.sun@huawei.com>
Change-Id:  I372b5156e85a7e2e1189f2c53f6a8550b8393966
This commit is contained in:
zhouzebin 2021-11-01 21:43:13 +08:00 committed by sunfei
parent 509c86c737
commit bcd74b112a
4 changed files with 19 additions and 6 deletions

View File

@ -188,12 +188,21 @@ public:
Matrix4 ComputerRemaining(std::size_t startOffset) const;
void SetAlwaysRotate(bool alwaysRotate)
{
alwaysRotate_ = alwaysRotate;
}
bool operator==(const TransformOperations& other) const
{
bool equals = false;
if (alwaysRotate_) {
return false;
}
if (operations_.size() != other.operations_.size()) {
return false;
}
for (size_t index = 0; index < operations_.size(); index++) {
equals = equals | operations_[index] == other.operations_[index];
if (!equals) {
if (!(operations_[index] == other.operations_[index])) {
return false;
}
}
@ -202,6 +211,7 @@ public:
protected:
std::vector<TransformOperation> operations_;
bool alwaysRotate_ = false;
private:
std::size_t MatchingLength(const TransformOperations& to, const TransformOperations& from) const;

View File

@ -35,7 +35,7 @@ public:
void AnimateTo(const T& beginValue, const T& endValue)
{
if (endValue_ == endValue) {
if (endValue == endValue_) {
return;
}
endValue_ = endValue;

View File

@ -140,14 +140,17 @@ public:
{
operations_ = other;
blended = TransformOperations(operations_);
endValue_ = blended;
}
void PlayTransformAnimation(const AnimationOption& option, const std::vector<TransformOperation>& other)
void PlayTransformAnimation(
const AnimationOption& option, const std::vector<TransformOperation>& other, bool alwaysRotate = false)
{
SetAnimationOption(option);
auto target = TransformOperations(other);
TransformOperations::ParseOperationsToMatrix(operations_);
TransformOperations::ParseOperationsToMatrix(target.GetOperations());
target.SetAlwaysRotate(alwaysRotate);
AnimateTo(blended, target);
// just move to target, renderNode should use blended to computer matrix
MoveTo(target);

View File

@ -135,7 +135,7 @@ public:
renderNode->transformAnimation_.SetEvaluator(nullptr);
}
});
transformAnimation_.PlayTransformAnimation(option, std::vector<TransformOperation>());
transformAnimation_.PlayTransformAnimation(option, std::vector<TransformOperation>(), true);
}
}