startAnimation: function(
   anim: {
     node: any;
     duration: number;
     easing: ($Enum<typeof AnimationUtils.Defaults> | EasingFunction);
     property: $Enum<typeof Properties>;
     toValue: ValueType;
     fromValue?: ValueType;
     delay?: number;
   },
   callback?: ?(finished: bool) => void
 ): number {
   var nodeHandle = React.findNodeHandle(anim.node);
   var easingSample = AnimationUtils.evaluateEasingFunction(
     anim.duration,
     anim.easing
   );
   var tag: number = AnimationUtils.allocateTag();
   var props = {};
   props[anim.property] = {to: anim.toValue};
   RCTAnimationManager.startAnimation(
     nodeHandle,
     tag,
     anim.duration,
     anim.delay,
     easingSample,
     props,
     callback
   );
   return tag;
 },
Example #2
0
  startAnimation: function(
    refKey: string,
    duration: number,
    delay: number,
    easing: (string | EasingFunction),
    properties: {[key: string]: any}
  ): number {
    var ref = this.refs[refKey];
    invariant(
      ref,
      'Invalid refKey ' + refKey + '; ' +
      'valid refs: ' + JSON.stringify(Object.keys(this.refs))
    );

    var nodeHandle = +ref.getNodeHandle();
    var easingSample = AnimationUtils.evaluateEasingFunction(duration, easing);
    var tag: number = RCTAnimationManager.startAnimation(nodeHandle, AnimationUtils.allocateTag(), duration, delay, easingSample, properties);
    return tag;
  },