• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java WXAnimationBean类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.taobao.weex.ui.animation.WXAnimationBean的典型用法代码示例。如果您正苦于以下问题:Java WXAnimationBean类的具体用法?Java WXAnimationBean怎么用?Java WXAnimationBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

WXAnimationBean类属于com.taobao.weex.ui.animation包,在下文中一共展示了WXAnimationBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseAnimation

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private void parseAnimation() {
  for(final Pair<String, Map<String, Object>> pair:animations) {
    if (!TextUtils.isEmpty(pair.first)) {
      final WXAnimationBean animationBean = createAnimationBean(pair.first, pair.second);
      if (animationBean != null) {
        mNormalTasks.add(new IWXRenderTask() {
          @Override
          public void execute() {
            mWXRenderManager.startAnimation(mInstanceId, pair.first, animationBean, null);
          }

          @Override
          public String toString() {
            return "startAnimationByStyle";
          }
        });
      }
    }
  }
}
 

开发者ID:amap-demo,
项目名称:weex-3d-map,
代码行数:21,
代码来源:WXDomStatement.java

示例2: startAnimation

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
void startAnimation(@NonNull final String ref, @NonNull String animation,
                    @Nullable final String callBack){
  if (mDestroy) {
    return;
  }
  WXDomObject domObject = mRegistry.get(ref);
  if (domObject == null) {
    return;
  }
  final WXAnimationBean animationBean=createAnimationBean(ref, animation);
  if(animationBean!=null) {
    mNormalTasks.add(new IWXRenderTask() {
      @Override
      public void execute() {
        mWXRenderManager.startAnimation(mInstanceId, ref, animationBean, callBack);
      }

      @Override
      public String toString() {
        return "startAnimationByCall";
      }
    });
  }
}
 

开发者ID:amap-demo,
项目名称:weex-3d-map,
代码行数:25,
代码来源:WXDomStatement.java

示例3: createAnimationBean

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private WXAnimationBean createAnimationBean(String ref, String animation){
  try {
    WXAnimationBean animationBean =
        JSONObject.parseObject(animation, WXAnimationBean.class);
    if (animationBean != null && animationBean.styles != null) {
      WXDomObject domObject=mRegistry.get(ref);
      int width=(int)domObject.getLayoutWidth();
      int height=(int)domObject.getLayoutHeight();
      animationBean.styles.init(animationBean.styles.transformOrigin,
                                animationBean.styles.transform,width,height);
    }
    return animationBean;
  } catch (RuntimeException e) {
    WXLogUtils.e("", e);
    return null;
  }
}
 

开发者ID:amap-demo,
项目名称:weex-3d-map,
代码行数:18,
代码来源:WXDomStatement.java

示例4: createAnimationBean

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private WXAnimationBean createAnimationBean(String ref,Map<String, Object> style){
  if (style != null) {
    try {
      Object transform = style.get(WXDomObject.TRANSFORM);
      if (transform instanceof String && !TextUtils.isEmpty((String) transform)) {
        String transformOrigin = (String) style.get(WXDomObject.TRANSFORM_ORIGIN);
        WXAnimationBean animationBean = new WXAnimationBean();
        WXDomObject domObject = mRegistry.get(ref);
        int width = (int) domObject.getLayoutWidth();
        int height = (int) domObject.getLayoutHeight();
        animationBean.styles = new WXAnimationBean.Style();
        animationBean.styles.init(transformOrigin, (String) transform, width, height,WXSDKManager.getInstanceViewPortWidth(mInstanceId));
        return animationBean;
      }
    }catch (RuntimeException e){
      WXLogUtils.e("", e);
      return null;
    }
  }
  return null;
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:22,
代码来源:DOMActionContextImpl.java

示例5: executeDom

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
@Override
public void executeDom(DOMActionContext context) {
  try {
    WXDomObject domObject;
    if (!context.isDestory() &&
        !TextUtils.isEmpty(animation) &&
        (domObject = context.getDomByRef(ref)) != null) {
      WXAnimationBean animationBean = JSONObject.parseObject(animation, WXAnimationBean.class);
      if (animationBean != null && animationBean.styles != null) {
        int width = (int) domObject.getLayoutWidth();
        int height = (int) domObject.getLayoutHeight();
        animationBean.styles.init(animationBean.styles.transformOrigin,
                                  animationBean.styles.transform, width, height,
                                  context.getInstance().getInstanceViewPortWidth());
        mAnimationBean = animationBean;
        context.postRenderTask(this);
      }
    }
  } catch (RuntimeException e) {
    WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
  }
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:23,
代码来源:AnimationAction.java

示例6: startAnimation

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
void startAnimation(@NonNull final String ref, @NonNull String animation,
                    @Nullable final String callBack){
  if (mDestroy) {
    return;
  }
  WXDomObject domObject = mRegistry.get(ref);
  if (domObject == null) {
    return;
  }
  final WXAnimationBean animationBean=createAnimationBean(ref, animation);
  if(animationBean!=null) {
    mNormalTasks.add(new IWXRenderTask() {
      @Override
      public void execute() {
        mWXRenderManager.startAnimation(mInstanceId, ref, animationBean, callBack);
      }

      @Override
      public String toString() {
        return "startAnimationByCall";
      }
    });
    mDirty=true;
  }
}
 

开发者ID:erguotou520,
项目名称:weex-uikit,
代码行数:26,
代码来源:WXDomStatement.java

示例7: createAnimationBean

点赞 3

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private WXAnimationBean createAnimationBean(String ref, String animation){
  try {
    WXAnimationBean animationBean =
        JSONObject.parseObject(animation, WXAnimationBean.class);
    if (animationBean != null && animationBean.styles != null) {
      WXDomObject domObject=mRegistry.get(ref);
      int width=(int)domObject.getLayoutWidth();
      int height=(int)domObject.getLayoutHeight();
      animationBean.styles.init(animationBean.styles.transformOrigin,
                                animationBean.styles.transform,width,height,WXSDKManager.getInstance().getSDKInstance(mInstanceId).getViewPortWidth());
    }
    return animationBean;
  } catch (RuntimeException e) {
    WXLogUtils.e("", e);
    return null;
  }
}
 

开发者ID:erguotou520,
项目名称:weex-uikit,
代码行数:18,
代码来源:WXDomStatement.java

示例8: startAnimation

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
public void startAnimation(String instanceId, @NonNull String ref,
                           @NonNull WXAnimationBean animationBean, @Nullable String
    callBack) {
  WXRenderStatement statement = mRegistries.get(instanceId);
  if (statement == null) {
    return;
  }
  statement.startAnimation(ref, animationBean, callBack);
}
 

开发者ID:amap-demo,
项目名称:weex-3d-map,
代码行数:10,
代码来源:WXRenderManager.java

示例9: parseAnimation

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private void parseAnimation() {
  for (final Pair<String, Map<String, Object>> pair : animations) {
    if (!TextUtils.isEmpty(pair.first)) {
      final WXAnimationBean animationBean = createAnimationBean(pair.first, pair.second);
      if (animationBean != null) {
        postRenderTask(Actions.getAnimationAction(pair.first, animationBean));
      }
    }
  }
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:11,
代码来源:DOMActionContextImpl.java

示例10: AnimationAction

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
AnimationAction(@NonNull String ref, @NonNull WXAnimationBean animationBean,
                @Nullable final String callBack) {
  this.ref = ref;
  this.mAnimationBean = animationBean;
  this.callback = callBack;
  this.animation = null;
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:8,
代码来源:AnimationAction.java

示例11: createTimeInterpolator

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private
@Nullable
Interpolator createTimeInterpolator() {
  String interpolator = mAnimationBean.timingFunction;
  if (!TextUtils.isEmpty(interpolator)) {
    switch (interpolator) {
      case WXAnimationBean.EASE_IN:
        return new AccelerateInterpolator();
      case WXAnimationBean.EASE_OUT:
        return new DecelerateInterpolator();
      case WXAnimationBean.EASE_IN_OUT:
        return new AccelerateDecelerateInterpolator();
      case WXAnimationBean.LINEAR:
        return new LinearInterpolator();
      default:
        //Parse cubic-bezier
        try {
          SingleFunctionParser<Float> parser = new SingleFunctionParser<>(
              mAnimationBean.timingFunction,
              new SingleFunctionParser.FlatMapper<Float>() {
                @Override
                public Float map(String raw) {
                  return Float.parseFloat(raw);
                }
              });
          List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER);
          if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
            return PathInterpolatorCompat.create(
                params.get(0), params.get(1), params.get(2), params.get(3));
          } else {
            return null;
          }
        } catch (RuntimeException e) {
          return null;
        }
    }
  }
  return null;
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:40,
代码来源:AnimationAction.java

示例12: startAnimation

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
void startAnimation(String ref, String animation, String callBack) {
  WXComponent component = mRegistry.get(ref);
  if (component == null || component.getRealView() == null) {
    return;
  } else {
    try {
      WXAnimationBean animationBean = WXAnimationModule.parseAnimation(animation, component.getRealView().getLayoutParams());
      if (animationBean != null) {
        Animator animator = WXAnimationModule.createAnimator(animationBean, component.getRealView());
        if (animator != null) {
          Animator.AnimatorListener animatorListener = WXAnimationModule.createAnimatorListener(mWXSDKInstance, callBack);
          Interpolator interpolator = WXAnimationModule.createTimeInterpolator(animationBean);
          if (animatorListener != null) {
            animator.addListener(animatorListener);
          }
          if (interpolator != null) {
            animator.setInterpolator(interpolator);
          }
          animator.setDuration(animationBean.duration);
          animator.start();
        }
      }
    } catch (RuntimeException e) {
      WXLogUtils.e(WXLogUtils.getStackTrace(e));
    }
  }
}
 

开发者ID:Laisly,
项目名称:weex,
代码行数:28,
代码来源:WXRenderStatement.java

示例13: startAnimation

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
void startAnimation(@NonNull String ref, @NonNull WXAnimationBean animationBean, @Nullable String callBack) {
  WXAnimationModule.startAnimation(mWXSDKInstance, mRegistry.get(ref), animationBean, callBack);
}
 

开发者ID:amap-demo,
项目名称:weex-3d-map,
代码行数:4,
代码来源:WXRenderStatement.java

示例14: getAnimationAction

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
public static RenderAction getAnimationAction(@NonNull String ref,
                                              @NonNull final WXAnimationBean animationBean){
  return new AnimationAction(ref, animationBean);
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:5,
代码来源:Actions.java

示例15: createAnimator

点赞 2

import com.taobao.weex.ui.animation.WXAnimationBean; //导入依赖的package包/类
private
@Nullable
ObjectAnimator createAnimator(final View target, final int viewPortWidth) {
  if (target == null) {
    return null;
  }
  WXAnimationBean.Style style = mAnimationBean.styles;
  if (style != null) {
    ObjectAnimator animator;
    List<PropertyValuesHolder> holders = style.getHolders();
    if (!TextUtils.isEmpty(style.backgroundColor)) {
      BorderDrawable borderDrawable;
      if ((borderDrawable = WXViewUtils.getBorderDrawable(target)) != null) {
        holders.add(PropertyValuesHolder.ofObject(
            new BackgroundColorProperty(), new ArgbEvaluator(),
            borderDrawable.getColor(),
            WXResourceUtils.getColor(style.backgroundColor)));
      } else if (target.getBackground() instanceof ColorDrawable) {
        holders.add(PropertyValuesHolder.ofObject(
            new BackgroundColorProperty(), new ArgbEvaluator(),
            ((ColorDrawable) target.getBackground()).getColor(),
            WXResourceUtils.getColor(style.backgroundColor)));
      }
    }

    if (target.getLayoutParams() != null &&
        (!TextUtils.isEmpty(style.width) || !TextUtils.isEmpty(style.height))) {
      ViewGroup.LayoutParams layoutParams = target.getLayoutParams();
      if (!TextUtils.isEmpty(style.width)) {
        holders.add(PropertyValuesHolder.ofInt(new WidthProperty(), layoutParams.width,
            (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.width), viewPortWidth)));
      }
      if (!TextUtils.isEmpty(style.height)) {
        holders.add(PropertyValuesHolder.ofInt(new HeightProperty(), layoutParams.height,
            (int) WXViewUtils.getRealPxByWidth(WXUtils.getFloat(style.height), viewPortWidth)));
      }
    }

    if (style.getPivot() != null) {
      Pair<Float, Float> pair = style.getPivot();
      target.setPivotX(pair.first);
      target.setPivotY(pair.second);
    }
    animator = ObjectAnimator.ofPropertyValuesHolder(
        target, holders.toArray(new PropertyValuesHolder[holders.size()]));
    animator.setStartDelay(mAnimationBean.delay);
    return animator;
  } else {
    return null;
  }
}
 

开发者ID:weexext,
项目名称:ucar-weex-core,
代码行数:52,
代码来源:AnimationAction.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)