# DOTween Unity UI Image Crossfade Just a quick hack to fade between UI Image sprites. I whipped up a quick shader for optimization but didn't have time to adjust it to fix sprites of different ratios when the Image component used `Preserve Aspect Ratio` Works as is, simple and easy. Here's an example of some cat pictures I found. ![Crossfading Cattos](https://i.imgur.com/QQ6ULkG.gif) # Example of usage ```C# Sprite myNextSprite; // Assuming this is set const float duration = 0.3f; // 300ms animation duration myImage.DOKill(); // It's a good idea to kill off previous animations myImage.DOCrossfadeImage(myNextSprite, duration, () => { //A callback for when complete. Just a hacky way of getting a callback. // NOTE: Will not be called if killed. Debug.Log("Crossfade animation completed successfully"); }); ``` # MIT License Go ahead and use it for whatever and stuff. If you improve it please feel free to let me know and I'll update this so we can all give a little back to the community.