How to do a fadein of an image on an Android Activity screen?

Hi Hiroshi you can do this for the fade in: ImageView myImageView= (ImageView)findViewById(R.id.myImageView); Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.fadein); myImageView.startAnimation(myFadeInAnimation); //Set animation to your ImageView and inside your res\anim\ folder the animation file fadein.xml <?xml version=”1.0″ encoding=”UTF-8″?> <set xmlns:android=”http://schemas.android.com/apk/res/android”> <alpha android:fromAlpha=”0.0″ android:toAlpha=”1.0″ android:interpolator=”@android:anim/accelerate_interpolator” android:duration=”3000″/> </set> but for the gradual fade in from sepia to the full … Read more

Fading out text at bottom of a section with transparent div, but height stays under section after overlaying div

Answer for 2020: This effect can now be achieved with true alpha transparency, without the need to cover the bottom with an additional <div>. Simply use the CSS mask-image property with a linear gradient that fades from black to transparent. The browser should take care of the rest for you. Demo: .container { -webkit-mask-image: linear-gradient(to … Read more

Pure JavaScript fade in function

Based on this site EDIT-1 Added the functionality so that user can specify the animation duration(@Marzian comment) You can try this: function fadeIn(el, time) { el.style.opacity = 0; var last = +new Date(); var tick = function() { el.style.opacity = +el.style.opacity + (new Date() – last) / time; last = +new Date(); if (+el.style.opacity < … Read more

CSS how to make an element fade in and then fade out?

Use css @keyframes .elementToFadeInAndOut { opacity: 1; animation: fade 2s linear; } @keyframes fade { 0%,100% { opacity: 0 } 50% { opacity: 1 } } here is a DEMO .elementToFadeInAndOut { width:200px; height: 200px; background: red; -webkit-animation: fadeinout 4s linear forwards; animation: fadeinout 4s linear forwards; } @-webkit-keyframes fadeinout { 0%,100% { opacity: 0; … Read more

Android fade in and fade out with ImageView

I wanted to achieve the same goal as you, so I wrote the following method which does exactly that if you pass it an ImageView and a list of references to image drawables. ImageView demoImage = (ImageView) findViewById(R.id.DemoImage); int imagesToShow[] = { R.drawable.image1, R.drawable.image2,R.drawable.image3 }; animate(demoImage, imagesToShow, 0,false); private void animate(final ImageView imageView, final int … Read more