This repository was archived by the owner on Dec 27, 2024. It is now read-only.
-
Couldn't load subscription status.
- Fork 172
MotionLayout XML JSON DSL map
John Hoford edited this page Nov 26, 2022
·
12 revisions
XML for MotionLayout works with a
- res/layout/layout_containing_motionlayout.xml
- res/xml/motion_scene.xml
MotionScene XML contains
<MotionScene>
<Transition>
<OnSwipe/>
<OnClick/> - Not implemented in Compose
<KeyFrameSet>
<KeyAttribute/>
<KeyPosition/>
<KeyCycle/>
<KeyTimeCycle/> - Not implemented in Compose
<KeyTrigger/> - Not implemented in Compose
</KeyFrameSet>
</Transition>
<ConstraintSet>
<ViewTransition/> - Not implemented in Compose
<ConstraintSet/>
<include/>
</MotionScene>#Transition
| XML | JSON | DSL | Example |
|---|---|---|---|
| android:id | |||
| constraintSetStart | to: | ||
| constraintSetEnd | From: | ||
| transitionDisable | TBD | ||
| layoutDuringTransition | N/A | ||
| autoTransition | TBD | ||
| motionInterpolator | |||
| duration | duration | ||
| staggered | staggered | ||
| transitionFlags | N/A | ||
| pathMotionArc | pathMotionArc: |
#OnSwipe
| XML | JSON | DSL | Example |
|---|---|---|---|
| dragScale | scale: | ||
| dragThreshold | threshold: | ||
| autoCompleteMode | mode: | ||
| maxVelocity | maxVelocity: | ||
| maxAcceleration | maxAccel: | ||
| springMass | springMass: | ||
| springStiffness | springStiffness: | ||
| springDamping | springDamping: | ||
| springStopThreshold | stopThreshold: | ||
| springBoundary | springBoundary: | ||
| dragDirection | direction: | ||
| touchAnchorId | anchor: | ||
| touchAnchorSide | side: | ||
| rotationCenterId | around: | ||
| touchRegionId | N/A | ||
| limitBoundsTo | limitBounds: | ||
| nestedScrollFlags | N/A | ||
| moveWhenScrollAtTop | N/A | ||
| onTouchUp | touchUp: |
#OnClick Not available
| XML | JSON | DSL | Example |
|---|---|---|---|
| targetId | |||
| clickAction |
#KeyFrameSet
In XML KeyFrameSet is a container for KeyAttribute, KeyCycle, and KeyTrigger.
#KeyAttribute
| XML | JSON | DSL | Example |
|---|---|---|---|
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyPosition
| XML | JSON | DSL | Example |
|---|---|---|---|
| keyPositionType | |||
| percentX | |||
| percentY | |||
| percentWidth | |||
| percentHeight | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| pathMotionArc | |||
| curveFit | |||
| drawPath | |||
| sizePercent |
#KeyCycle
| XML | JSON | DSL | Example |
|---|---|---|---|
| waveShape | |||
| wavePhase | |||
| wavePeriod | |||
| waveOffset | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyTimeCycle
Not implemented in Compose
| XML | JSON | DSL | Example |
|---|---|---|---|
| waveShape | |||
| wavePhase | |||
| wavePeriod | |||
| waveOffset | |||
| framePosition | |||
| motionTarget | |||
| transitionEasing | |||
| curveFit | |||
| motionProgress | |||
| android:alpha | |||
| android:elevation | |||
| android:rotation | |||
| android:rotationX | |||
| android:rotationY | |||
| android:transformPivotX | |||
| android:transformPivotY | |||
| transformPivotTarget | |||
| transitionPathRotate | |||
| android:scaleX | |||
| android:scaleY | |||
| android:translationX | |||
| android:translationY | |||
| android:translationZ |
#KeyTrigger Not implemented in Compose
| XML | JSON | DSL | Example |
|---|---|---|---|
| framePosition | |||
| motionTarget | |||
| triggerReceiver | |||
| onNegativeCross | |||
| onPositiveCross | |||
| onCross | |||
| viewTransitionOnNegativeCross | |||
| viewTransitionOnPositiveCross | |||
| viewTransitionOnCross | |||
| triggerSlack | |||
| triggerId | |||
| motion_postLayoutCollision | |||
| motion_triggerOnCollision |
#ViewTransition
Not implemented in Compose
<declare-styleable name="ViewTransition">
<attr name="android:id" />
<attr name="motionTarget" />
<attr name="viewTransitionMode" />
<attr name="onStateTransition" />
<attr name="duration" />
<attr name="upDuration" format="integer" />
<attr name="transitionDisable" />
<attr name="pathMotionArc" />
<attr name="motionInterpolator" />
<attr name="SharedValueId" format="reference"/>
<attr name="SharedValue" format="integer"/>
<attr name="setsTag" format="reference"/>
<attr name="clearsTag" format="reference"/>
<attr name="ifTagSet" format="reference"/>
<attr name="ifTagNotSet" format="reference"/>
</declare-styleable>#ConstraintSet See separate page on on ConstraintSet