Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone ever done a basic 'scan-animation' on an image?

I am looking into having a basic red-bar scan across an image displayed on an image view a vew times, back and forth, as to make it seem like a picture is being scanned. Has anyone ever done this, know how easy it is or could they point me in the right direction on how to do this?

Thanks!

like image 497
Sapp Avatar asked Nov 23 '10 23:11

Sapp


1 Answers

Step #1: Create a PNG file (or possibly a ShapeDrawable) that is your scan bar, with appropriate transparency as you see fit.

Step #2: Add an ImageView to your RelativeLayout that holds the image from step #1, possibly set to have android:visible="gone" at the outset. Make sure the ImageView is a later child of the RelativeLayout than is your ImageView that you are "scanning", so it will appear to float on top.

Step #3: Use a TranslateAnimation to animate the ImageView from step #2 (after making it visible) by whatever pattern you want.

Step #4: When the animation is complete (via the AnimationListener), make the ImageView be gone again to return you to the state you were before the animation began.

like image 127
CommonsWare Avatar answered Sep 20 '22 09:09

CommonsWare