How to fade part of an image

Laurent

I have a kind of simple donut chart gradually colored. I want this donut be faded depending on a value. For example if the value is 35 then 35 % of my donut would be not faded and 65 % would be faded. I don't want any animation.

This is an example of what I want to achieve :

enter image description here

The code for the donut without the masking feature :

<ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:srcCompat="@drawable/donut"
        android:layout_alignTop="@+id/imageView"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"/>
Stefan

You could also use some masking in combination with a semi-transparent image using the following steps.

  • create a black/white donut up to e.g. 35 %,
  • mask your semi-transperant with this donut (e.g. make all black parts fully transparent)
  • use this masked image as overlay for your full coloured donut.

This will leave you with a partly faded donut following the same contours as the original.

I am sorry I don't have any masking-code at hand, but these steps would accomplish the desired result.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

To fade only a part of a image in html

How to fade in closest image?

How to fade WPF background image?

How to fade in UI image in Unity

How to fade div out, change background image and fade in within a loop?

How to Initiate Image Fade Out and Fade In with jQuery Function

on hover and on click how to fade out image and fade in content text

How smoothly change image source with fade-in/fade-out?

How do I fade an image in swing?

How would i make background image fade in?

How to disable image fade in effect in React Native?

How to fade an image with CSS without opacity?

How to create a dark fade + text on image hover?

How to fade a background image to transparent, in a gradient fashion?

How to blur part of a image?

Hover over div/image to fade out image and have text fade in, but hovering over text removes fade out of image. How to prevent?

How to fade edges of background image of element to blend in with the main background image?

Fade Out an Image when click on button, change image url and then fade in. How to do it?

How to display a part of a big image?

How to extract part of this image in Java?

How to magnify certain part of the image?

how to draw part of the image with libgdx

How to show the only part of the image

How to detect that PART of an image was shifted?

How to delete a certain part of an Image?

How to analyze only a part of an image?

How to rotate a particular part in an image?

How to make part of an image an href?

How do you fade in/fade out same div onclick of image using JQuery?