Skip to content

Commit

Permalink
feat(ohos): fix animation translate & scale (#132)
Browse files Browse the repository at this point in the history
Co-authored-by: tandyyan <[email protected]>
  • Loading branch information
2 people authored and etkmao committed Jan 15, 2025
1 parent 566842a commit b09aebc
Showing 1 changed file with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,17 +133,25 @@ bool HRConvertUtils::TransformToArk(HippyValueArrayType &valueArray, HRTransform
if (!it.second.ToDouble(value)) {
continue;
}
HRScale scale;
scale.x = static_cast<float>(value);
transform.scale = scale;
if (transform.scale) {
transform.scale->x = static_cast<float>(value);
} else {
HRScale scale;
scale.x = static_cast<float>(value);
transform.scale = scale;
}
} else if (it.first == "scaleY") {
double value = 0;
if (!it.second.ToDouble(value)) {
continue;
}
HRScale scale;
scale.y = static_cast<float>(value);
transform.scale = scale;
if (transform.scale) {
transform.scale->y = static_cast<float>(value);
} else {
HRScale scale;
scale.y = static_cast<float>(value);
transform.scale = scale;
}
} else if (it.first == "translate") {
HippyValueArrayType array;
if (!it.second.IsArray() || !it.second.ToArray(array)) {
Expand Down Expand Up @@ -174,17 +182,25 @@ bool HRConvertUtils::TransformToArk(HippyValueArrayType &valueArray, HRTransform
if (!it.second.ToDouble(value)) {
continue;
}
HRTranslate translate;
translate.x = static_cast<float>(value);
transform.translate = translate;
if (transform.translate) {
transform.translate->x = static_cast<float>(value);
} else {
HRTranslate translate;
translate.x = static_cast<float>(value);
transform.translate = translate;
}
} else if (it.first == "translateY") {
double value = 0;
if (!it.second.ToDouble(value)) {
continue;
}
HRTranslate translate;
translate.y = static_cast<float>(value);
transform.translate = translate;
if (transform.translate) {
transform.translate->y = static_cast<float>(value);
} else {
HRTranslate translate;
translate.y = static_cast<float>(value);
transform.translate = translate;
}
} else if (it.first == "skewX") {
} else if (it.first == "skewY") {
} else {
Expand Down

0 comments on commit b09aebc

Please sign in to comment.