public Transition GenerateNextTransition(RectF drawableBounds, RectF viewport) { bool firstTransition = _mLastGenTrans == null; bool drawableBoundsChanged = true; bool viewportRatioChanged = true; RectF srcRect = null; RectF dstRect = null; if (!firstTransition) { dstRect = _mLastGenTrans.GetDestinyRect(); drawableBoundsChanged = !drawableBounds.Equals(_mLastDrawableBounds); viewportRatioChanged = !MathUtils.HaveSameAspectRatio(dstRect, viewport); } if (dstRect == null || drawableBoundsChanged || viewportRatioChanged) { srcRect = GenerateRandomRect(drawableBounds, viewport); } else { /* Sets the destiny rect of the last transition as the source one if the current drawable has the same dimensions as the one of the last transition. */ srcRect = dstRect; } dstRect = GenerateRandomRect(drawableBounds, viewport); _mLastGenTrans = new Transition(srcRect, dstRect, _mTransitionDuration, _mTransitionIInterpolator); _mLastDrawableBounds = drawableBounds; return _mLastGenTrans; }