feat:support alpha
This commit is contained in:
parent
e2df869b52
commit
7e8708a73b
@ -203,6 +203,17 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
prop.asObject().getProperty("color").asNumber().toInt());
|
prop.asObject().getProperty("color").asNumber().toInt());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "alpha":
|
||||||
|
if (isAnimating()) {
|
||||||
|
addAnimator(ObjectAnimator.ofFloat(
|
||||||
|
this,
|
||||||
|
name,
|
||||||
|
getAlpha(),
|
||||||
|
prop.asNumber().toFloat()));
|
||||||
|
} else {
|
||||||
|
setAlpha(prop.asNumber().toFloat());
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "corners":
|
case "corners":
|
||||||
if (prop.isNumber()) {
|
if (prop.isNumber()) {
|
||||||
if (isAnimating()) {
|
if (isAnimating()) {
|
||||||
@ -518,6 +529,16 @@ public abstract class ViewNode<T extends View> extends DoricContextHolder {
|
|||||||
mView.setBackgroundColor(color);
|
mView.setBackgroundColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DoricMethod
|
||||||
|
public void setAlpha(float alpha) {
|
||||||
|
getNodeView().setAlpha(alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DoricMethod
|
||||||
|
public float getAlpha() {
|
||||||
|
return getNodeView().getAlpha();
|
||||||
|
}
|
||||||
|
|
||||||
@DoricMethod
|
@DoricMethod
|
||||||
public void setCorners(float corner) {
|
public void setCorners(float corner) {
|
||||||
requireDoricLayer().setCornerRadius(DoricUtils.dp2px(corner));
|
requireDoricLayer().setCornerRadius(DoricUtils.dp2px(corner));
|
||||||
|
@ -150,6 +150,8 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
view.y = [(NSNumber *) prop floatValue];
|
view.y = [(NSNumber *) prop floatValue];
|
||||||
} else if ([name isEqualToString:@"bgColor"]) {
|
} else if ([name isEqualToString:@"bgColor"]) {
|
||||||
view.backgroundColor = DoricColor(prop);
|
view.backgroundColor = DoricColor(prop);
|
||||||
|
} else if ([name isEqualToString:@"alpha"]) {
|
||||||
|
view.alpha = [prop floatValue];
|
||||||
} else if ([name isEqualToString:@"layoutConfig"]) {
|
} else if ([name isEqualToString:@"layoutConfig"]) {
|
||||||
if (self.superNode && [prop isKindOfClass:[NSDictionary class]]) {
|
if (self.superNode && [prop isKindOfClass:[NSDictionary class]]) {
|
||||||
[self.superNode blendSubNode:self layoutConfig:prop];
|
[self.superNode blendSubNode:self layoutConfig:prop];
|
||||||
@ -220,10 +222,6 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
|||||||
self.pivotY = prop;
|
self.pivotY = prop;
|
||||||
} else if ([name isEqualToString:@"rotation"]) {
|
} else if ([name isEqualToString:@"rotation"]) {
|
||||||
self.rotation = prop;
|
self.rotation = prop;
|
||||||
} else if ([name isEqualToString:@"rotationX"]) {
|
|
||||||
self.rotationX = prop;
|
|
||||||
} else if ([name isEqualToString:@"rotationY"]) {
|
|
||||||
self.rotationY = prop;
|
|
||||||
} else {
|
} else {
|
||||||
DoricLog(@"Blend View error for View Type :%@, prop is %@", self.class, name);
|
DoricLog(@"Blend View error for View Type :%@, prop is %@", self.class, name);
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,9 @@ export interface IView {
|
|||||||
corners?: number | { leftTop?: number; rightTop?: number; leftBottom?: number; rightBottom?: number }
|
corners?: number | { leftTop?: number; rightTop?: number; leftBottom?: number; rightBottom?: number }
|
||||||
border?: { width: number; color: Color; }
|
border?: { width: number; color: Color; }
|
||||||
shadow?: { color: Color; opacity: number; radius: number; offsetX: number; offsetY: number }
|
shadow?: { color: Color; opacity: number; radius: number; offsetX: number; offsetY: number }
|
||||||
|
/**
|
||||||
|
* float [0,..1]
|
||||||
|
*/
|
||||||
alpha?: number
|
alpha?: number
|
||||||
hidden?: boolean
|
hidden?: boolean
|
||||||
padding?: {
|
padding?: {
|
||||||
|
Reference in New Issue
Block a user