79790099

Date: 2025-10-14 11:01:10
Score: 1
Natty:
Report link

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

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Jefferson