# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://elizacamber.gitbook.io/animations-2018/creating-a-self-contained-motionscene.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
