Skip to content

Instantly share code, notes, and snippets.

@FarshadTahmasbi
Created April 3, 2020 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FarshadTahmasbi/b391e369010d75cf94fb50424dbd1fd3 to your computer and use it in GitHub Desktop.
Save FarshadTahmasbi/b391e369010d75cf94fb50424dbd1fd3 to your computer and use it in GitHub Desktop.
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