Created
April 3, 2020 20:11
-
-
Save FarshadTahmasbi/b391e369010d75cf94fb50424dbd1fd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val set = motion.getConstraintSet(R.id.start) | |
set.clear(R.id.img_motion) | |
set.constrainWidth(R.id.img_motion, img.width) | |
set.constrainHeight(R.id.img_motion, img.height) | |
set.connect( | |
R.id.img_motion, | |
ConstraintSet.START, | |
ConstraintSet.PARENT_ID, | |
ConstraintSet.START, | |
rect.left | |
) | |
when (clipType) { | |
CLIP_TOP -> set.connect( | |
R.id.img_motion, | |
ConstraintSet.BOTTOM, | |
ConstraintSet.PARENT_ID, | |
ConstraintSet.BOTTOM, | |
motion.bottom - rect.bottom | |
) | |
else -> set.connect( | |
R.id.img_motion, | |
ConstraintSet.TOP, | |
ConstraintSet.PARENT_ID, | |
ConstraintSet.TOP, | |
rect.top | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment