feat:add Color.alpha

This commit is contained in:
pengfei.zhou 2019-11-29 13:10:00 +08:00
parent 30c913f640
commit ed7e071a01
2 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,9 @@ class AnimatorDemo extends Panel {
view.width = view.height = 20 view.width = view.height = 20
}, },
duration: 3000, duration: 3000,
complete: () => {
modal(context).toast('Fininshed')
},
}) })
} }
}), }),
@ -35,9 +38,12 @@ class AnimatorDemo extends Panel {
v.onClick = () => { v.onClick = () => {
animator(this)({ animator(this)({
animations: () => { animations: () => {
view.width = 500 view.width = 300
}, },
duration: 3000, duration: 3000,
complete: () => {
modal(context).toast('Fininshed')
},
}) })
} }
}), }),
@ -67,7 +73,7 @@ class AnimatorDemo extends Panel {
}) })
]).apply({ ]).apply({
layoutConfig: layoutConfig().atmost(), layoutConfig: layoutConfig().atmost(),
bgColor: colors[3], bgColor: colors[1].alpha(0.3 * 255),
}), }),
]).apply({ ]).apply({
layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT), layoutConfig: layoutConfig().atmost().h(LayoutSpec.WRAP_CONTENT),

View File

@ -62,6 +62,10 @@ export class Color implements Modeling {
} }
} }
alpha(v: number) {
return new Color((this._value & 0xffffff) | ((v & 0xff) << 24))
}
toModel() { toModel() {
return this._value return this._value
} }