> For the complete documentation index, see [llms.txt](https://elizacamber.gitbook.io/animations-2018/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://elizacamber.gitbook.io/animations-2018/creating-a-self-contained-motionscene.md).

# Creating a self-contained MotionScene

The only difference between the main structure of the self-contained `MotionScene` and the one we saw before is that the `ConstraintSets` are described in this file instead of just referring to the layout IDs

Let's create a new `MotionScene` called `motion_scene_detail.xml`. For now let's copy-paste the same `MotionLayout` we created for the Main Activity (`motion_scene_main.xml`)

{% code title="motion\_scene\_detail.xml" %}

```
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:app="http://schemas.android.com/apk/res-auto">
    <Transition
        app:constraintSetEnd="@layout/activity_main_end"
        app:constraintSetStart="@layout/activity_main_start"
        app:duration="1000">

        <OnSwipe
            app:dragDirection="dragUp"
            app:touchAnchorId= "@id/second_bg"
            app:touchAnchorSide="top" />
    </Transition>
</MotionScene>
```

{% endcode %}

&#x20;We're not going to use the gesture handler so we can delete that. Additionally, instead of setting our constraints from the layout we mentioned that we're going to include our constraints here. To do so we need to specify a`ConstraintSet` for the start and one for the end.  Inside those `ConstraintSets` we'll include the `Constraint`s of our view(s). To add the "spin" we will add to our `Constraint` a rotation attribute.&#x20;

Once you're done you'll have again to add it as a `layoutDescription` in the item layout XML.
