更新时间:2023-12-04 21:15:22
如果您只想将图像从完全透明变淡为完全不透明,则只需执行以下操作:
If you just want to fade the image in from fully-transparent to fully-opaque, then just do the following:
ImageLayer faceLayer;
void init() {
Image faceImage = assetManager().getImage("images/face.png");
faceLayer = graphics().createImageLayer(faceImage);
graphics().rootLayer().add(faceLayer);
}
void update(float delta) {
float alpha = calcAlpha(delta);
faceLayer.setAlpha(alpha);
}
alpha范围从0(完全透明)到1(完全不透明).
Where alpha ranges from 0 (fully transparent) to 1 (fully opaque).