Monday, March 30, 2020

How to do animation on onscroll of segment

Add following code on form postshow:

Sample code:

setAnimationforSeg:function(){
    var transformObject1 = kony.ui.makeAffineTransform();
    var transformObject2 = kony.ui.makeAffineTransform();
    transformObject1.translate(200, 0);
    transformObject2.translate(0, 0);
    var animationObject = kony.ui.createAnimation(
      {"0":{"transform":transformObject1,"stepConfig":{"timingFunction":kony.anim.LINEAR}},
       "100":{"transform":transformObject2,"stepConfig":{"timingFunction":kony.anim.LINEAR}}});
    var animationConfig = {
      duration: 1,
      fillMode: kony.anim.FILL_MODE_FORWARDS
    };
    var animationCallbacks = {"animationEnd":function(){kony.print("animation END");}};
    var animationDefObject={definition:animationObject,config:animationConfig,callbacks:animationCallbacks};
    this.view.segCategorylist.setAnimations({visible:animationDefObject});
  },

Notes:Replace your segment name instead of segCategorylist from code.