Skip to content

Commit

Permalink
Merge pull request #651 from skydoves/fix/crossfade-state
Browse files Browse the repository at this point in the history
Fix instability of the crossfade plugin
  • Loading branch information
skydoves authored Feb 17, 2025
2 parents b36445f + b023570 commit 9182dbd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.compose.animation.core.MutableTransitionState
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.rememberTransition
import androidx.compose.animation.core.tween
import androidx.compose.animation.core.updateTransition
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal fun Painter.rememberCrossfadePainter(
durationMs: Int,
): Painter {
val size = Size(imageBitmap.width.toFloat(), imageBitmap.height.toFloat())
val colorMatrix = remember { ColorMatrix() }
val colorMatrix = remember(imageBitmap) { ColorMatrix() }
val fadeInTransition = updateFadeInTransition(key = size, durationMs = durationMs)
val transitionColorFilter = if (!fadeInTransition.isFinished) {
colorMatrix.apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import com.skydoves.landscapist.plugins.ImagePlugin
*/
@Immutable
public class CrossfadePlugin(
private val duration: Int = 550,
private val duration: Int = 250,
) : ImagePlugin.PainterPlugin {

@Composable
Expand Down

0 comments on commit 9182dbd

Please sign in to comment.