[英]Andengine fade in/out and alpha modifiers not working
I have a problem with AndEngine GLES2. 我有AndEngine GLES2的问题。
I have this code: 我有这个代码:
Sprite black = new Sprite(0,0, blackRegion, this.getVertexBufferObjectManager());
black.setSize(CAMERA_WIDTH, CAMERA_HEIGHT);
black.registerEntityModifier(new AlphaModifier(2, 0, 255));
mScene.attachChild(black);
So it's not working. 所以它不起作用。 Nothing does... 什么都没有......
What do I need to do? 我需要做什么?
Did you set the blend function properly? 您是否正确设置了混合功能? Example: 例:
sprite.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
I tried the above but it's not working for me as it should. 我尝试了上述内容,但它并不适合我。 The modifier works but instead of a steady fade out the image fades out a number of times for the mentioned duration. 修改器工作但不是稳定淡出,图像在上述持续时间内淡出多次。 Any ideas? 有任何想法吗?
Well ultimately i figured out what i was doing wrong. 最终我弄清楚我做错了什么。 Here's it... 这是它......
anySprite.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
IEntityModifier iem = new AlphaModifier(seconds, 0, 255); //for some unknown reason i was passing invalid values and hence it didn't work then :)
iem.setRemoveWhenFinished(true);
anySprite.registerEntityModifier(iem);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.