开发者

Set AlphaAnimation on GLSurfaceView

开发者 https://www.devze.com 2023-02-21 01:06 出处:网络
Is there a way to set the animation on a GLSurfaceView to fade from fully Opaque to 0 alpha transparency? 开发者_StackOverflowI have the following code which does nothing:

Is there a way to set the animation on a GLSurfaceView to fade from fully Opaque to 0 alpha transparency? 开发者_StackOverflowI have the following code which does nothing:

AlphaAnimation anim = new AlphaAnimation(1f, 0f);
anim.setDuration (5000);
anim.setFillAfter(true);
glSurfaceView.startAnimation(anim);

I understand a SurfaceView doesn't normally behave like a normal View object so is this the right way to go about this? Is there another better way? Is it possible at all?


I know it's an old thread, but it's possible to fade in/out SurfaceView by placing blank view with black background on top of it. Then you just apply AlphaAnimation on this view.


Maybe because SurfaceViews are just "punching a hole in the screen" as one Android developer put it once. They are slightly special in order to be superfast.

I don't know exactly what you're trying to accomplish, but maybe one solution would be to modify your GL code in order to perform that fade out in the gl drawing.

0

精彩评论

暂无评论...
验证码 换一张
取 消