Animating Crossfading between two images - Splash Screen - java

I am creating a splash screen for my app using multiple images. I have one main image that will be displayed as a Logo; behind the logo I intend to have two images - a green cloud, and a blue cloud, fading in and out a few times so it will create a kind of pulsing glow effect behind the logo. What is the best way to implement this type of effect? Basically the main image will stay static while the other two images switch back and forth from one to the other until the end of the splash intro. Thanks in advance for the help! BTW I am using Eclipse.

Have two images stacked - one way is in ht linear layout keep blue cloud as background and in the frame layout keep an ImageView. In the ImageView hold the green cloud. Now make the transparency of the image in the frame layout ("green cloud") fade in and fade out with its transparency. Call setAlpha in a loop -cycle the the argument to set Alpha - 0 is fully transparent wherein "blue cloud" is visible and 255 is fully opaque - "green cloud" is visible.

Related

Make an imageview blurred towards the vertical edges in Android

I would like to design a layout containing an imageview and a background view with two special effect. First is where the main imageview gets transformed with faded towards the vertical edges and second is a background imageview with a blurred effect like the image
The result that i am able to achieve
I saw this post for my first effect and currently using it, but it does not work when I change my phone into dark mode so I am not getting a perfect solution.
And the second special blur effect that i am able to achieve is far way different from what i want to achieve. The required blur effect has some hardness of the different shades of color and mine one is quite smooth. For my blur effect I am using the below code and I am using the library Fresco for my image.
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
.setPostprocessor(new IterativeBoxBlurPostProcessor(60)).build();
PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
.setImageRequest(request)
.setOldController(backgroundImage.getController())
.build();
backgroundImage.setController(controller);
Can anyone please suggest me any good solution or any good library for it or some code sample that can help me to achieve what I want.
The point to note here is the blurred background is an extension of the image itself. So if the left side of the screen has a purple hue the blurred region at the top left will be purple as well.
YOu can use a library like Blurry where it blurs the contents of the screen and then set that as a background. You can control the amount of blur you want.
Once you get the blurred image set it as the background of the container layout and set the picture in front
eg:
val bitmap = Blurry.with(this)
.radius(10) // make it more if you want the lue to be more
.sampling(8)
.capture(findViewById(R.id.right_bottom)).get() // get the view you want to blur
imageView.setImageDrawable(BitmapDrawable(resources, bitmap)) // set the value to the background

Bitmap (or view?) fading

If I display a bitmap as a background, and then draw 3 other, smaller, bitmaps on top, is there a way to fade the background without affecting the other 3 bitmaps?
Basically what I want to do is to move three 'sprite buttons' and a logo image onto the screen, over the top of the game screen, and have the background fade down while the buttons are displayed. When the buttons move off, I want the background to fade back in again.
Any ideas?
Look, this is a design question initially. I need to see if it's possible before I commit.
I have a background. On this I want to show 3 'sprites'. I want to fade the background down without fading the sprites. Is this possible and, if so, how best should it be done?
Considering that the background image will fade and the other 3 will not, is there a reason why they are in the same "container".
If not, then consider having only the background being altered, and the other three images isolated from the altering code.
If they must be drawned together or inside the same bitmap, consider having regions not to alter inside the bitmap, perhaps by clustering the image, and placing identifiers on those regions with a boolean (such as "isAlterable"), then only calling the fade on isAlterable clusters

Fading overlay through FrameLayout foreground with specified Rect that cuts out a section of the fade

Goal: A highlighted section of an image (the image covers the whole screen). The rest of the screen needs to be faded out.
Example
So far I've got the fading working using the foreground of a FrameLayout and placing the image as the background of a RelativeLayout within the FrameLayout. The solution I'm thinking is that I need to create 2 Drawables and merge them into one that FrameLayout Foreground can consume.
I've also been reading a bit up on PorterDuff, but I think that may be overkill for what I'm trying to achieve.
The fade functionality is working fine, but the source of the fade with transparent section is not.
I suggest that you have the original image in an ImageView on top of it place 4 views which are partially dimmed and that's it!
With some basic math you can know the sizes for each view, and using RelativeLayout will allow you to easily place them on the screen.
Good Luck!
P.S. I've attached a sketch to illustrate what I'm suggesting.

Fullscreen Rotating Background Image

Developing an app for Android and I'm required to have a fullscreen image rotate (spin around infinitely, pivoted at the centre of the screen) in the background.
I have tried rotating the ImageView using RotateAnimation which works well, except the image is cropped to the size of the parent view.
I have also tried expanding the parent view to a set size (750dp) but it doesn't work well across all the different screen sizes.
Does anyone know of an easy way to implement this, which would involve scaling to uniformly fit the screen size?
Cheers,
Dylan
Screenshot of the image:

Creating an Icon with a Tranparent Background

I'm using ImageIcons that I downloaded from a free icon site in my JButtons. Two of them have white backgrounds, and the other one has a black background. I would prefer not to have a background color clash, so I want to make all the backgrounds transparent. I've seen ways to make image backgrounds transparent, but I thought it was kinda roundabout to turn my ImageIcons into Images and back again. Is there a way to make the backgrounds of ImageIcons transparent without converting to Images?
This isn't a Java-solution, but it's a solution I use frequently nonetheless. Download/install Paint.NET and follow this discussion on how to make the background of images transparent. And then use the resulting image for the ImageIcon.
Another non java solution: with photoshop you can select a small white rectangle of the background part, and then menu "Select" > "Similar" if you want to delete all white pixels, or "Grow" if you want to delete all white pixels touching your existing selection.

Categories

Resources