Glow effect of android animation on image

I am working on an application where on my home page I need to give a luminous and fading animation of the effect to a logo (imageview), I tried a lot and could not find how to give a glow effect, and I know the glow effect for the onclick event, please help me with this problem Thanks in advance

public class CustomView extends ImageView{ public CustomView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomView(Context context, AttributeSet attrs) { super(context, attrs); } public CustomView(Context context) { super(context); } boolean drawGlow = false; //this is the pixel coordinates of the screen float glowX = 0; float glowY = 0; //this is the radius of the circle we are drawing float radius = 20; //this is the paint object which specifies the color and alpha level //of the circle we draw Paint paint = new Paint(); { paint.setAntiAlias(true); paint.setColor(Color.WHITE); paint.setAlpha(50); }; @Override public void draw(Canvas canvas){ super.draw(canvas); if(drawGlow) canvas.drawCircle(glowX, glowY, radius, paint); } @Override public boolean onTouchEvent(MotionEvent event){ if(event.getAction() == MotionEvent.ACTION_DOWN){ drawGlow = true; }else if(event.getAction() == MotionEvent.ACTION_UP) drawGlow = false; glowX = event.getX(); glowY = event.getY(); this.invalidate(); return true; } } 

This code is for touch event. I want an animation.

+6
source share
3 answers

For the effect of the effect of Glow The effect of glow and for

For flashing type of animation use this, it works, you have to change the Reapeatcount and Duration to suit your requirement

 AlphaAnimation blinkanimation= new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible blinkanimation.setDuration(300); // duration - half a second blinkanimation.setInterpolator(new LinearInterpolator()); // do not alter animation rate blinkanimation.setRepeatCount(3); // Repeat animation infinitely blinkanimation.setRepeatMode(Animation.REVERSE); 

after use as indicated below

 imageview.startAnimation(blinkanimation); or imageview.setAnimation(blinkanimation); 
+18
source

Plain

Take 2 sets of images, one bright and one sunny (Vivid)

Then you can use AlphaAnimation to animate the image.

+2
source

http://tekeye.biz/2012/animated-images-in-android This link provides an answer to my question by changing the image we can give a glow effect Thank you all for your time.

+2
source

Source: https://habr.com/ru/post/918626/


All Articles