use of com.taobao.weex.ui.animation.WXAnimationBean in project weex-example by KalicyZhou.
the class WXDomStatement method startAnimation.
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;
}
}
use of com.taobao.weex.ui.animation.WXAnimationBean in project weex-example by KalicyZhou.
the class WXDomStatement method createAnimationBean.
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;
}
}
use of com.taobao.weex.ui.animation.WXAnimationBean in project weex-example by KalicyZhou.
the class WXDomStatement method createAnimationBean.
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.getInstance().getSDKInstance(mInstanceId).getViewPortWidth());
return animationBean;
}
} catch (RuntimeException e) {
WXLogUtils.e("", e);
return null;
}
}
return null;
}
Aggregations