use ohos.animator and ohos.curves (Interpolation Calculation)
import { AnimatorResult } from '@kit.ArkUI';
@Entry
@Component
struct AnimatorTest {
private backAnimator: AnimatorResult | undefined = undefined
create() {
this.backAnimator = this.getUIContext().createAnimator({
duration: 2000,
easing: "ease",
delay: 0,
fill: "forwards",
direction: "normal",
iterations: 1,
begin: 100, // Start point of the animation interpolation.
end: 200 // End point of the animation interpolation.
})
this.backAnimator.onFrame = (value: number) => {
console.info("onFrame callback")
}
}
build() {
// ......
}
}
https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-animator
https://developer.huawei.com/consumer/en/doc/harmonyos-references/js-apis-curve