Animation.step

Requires:
Base Library≥2.21.8

Method signature
Animation.step(options?: )

Description

Marks completion of a group of animations. You can call any number of animation methods within a group; all animations in a group start simultaneously, and the next group runs only after the current one completes

Parameters

ParameterTypeRequiredDescription
NoAnimation step configuration

Return Value

Type: Animation
Animation instance

Valid Values

StepOption.timingFunction
ValueDescriptionSince
linearThe animation runs at a constant speed from start to finish-
easeThe animation starts slowly, then accelerates, and slows down before ending-
ease-inThe animation starts slowly-
ease-outThe animation ends slowly-
ease-in-outThe animation starts and ends slowly-
step-startThe animation jumps to the end state on the first frame and stays there until it ends-
step-endThe animation stays at the start state and jumps to the end state on the last frame-

Examples

Single-step animation

Page({
  data: {
    animationData: {},
  },
  onReady() {
    const animation = ty.createAnimation({ duration: 500 });
    animation.rotate(45).scale(2, 2).step();
    this.setData({ animationData: animation.export() });
  },
});

Multi-step animation and custom configuration

Page({
  data: {
    animationData: {},
  },
  onReady() {
    const animation = ty.createAnimation({ duration: 500 });
    animation.translate(100, 0).step();
    animation.rotate(180).step({ duration: 1000, timingFunction: 'ease-in' });
    this.setData({ animationData: animation.export() });
  },
});