Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[DRAFT] feat: configurable<MotionGroup> child element variants using:config-fn prop#193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
BobbieGoede wants to merge6 commits intovueuse:main
base:main
Choose a base branch
Loading
fromBobbieGoede:feat/motion-group-config-fn-prop
Draft
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
docs: add basic examples to components page
  • Loading branch information
@BobbieGoede
BobbieGoede committedMay 28, 2024
commit4364443b8489095af70c86a0a9cf0d01a9c461b9
40 changes: 40 additions & 0 deletionsdocs/components/content/examples/MotionComponent.vue
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
<script lang="ts" setup></script>

<template>
<div class="example-wrapper">
<div class="example-hint">Scroll down to trigger motion!</div>
<Motion is="p" preset="slideVisibleLeft">
<div class="example-target">Text in Motion!</div>
</Motion>
</div>
</template>

<style scoped>
.example-wrapper {
height: 200px;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
border: 1px solid #222;
border-radius: 0.5em;
}

.example-hint,
p {
display: flex;
flex: 1 0;

align-items: center;
justify-content: center;

height: 100%;
padding: 2em;
}

.example-target {
padding: 1em;
background-color: #111;
border-radius: 0.5em;
}
</style>
58 changes: 58 additions & 0 deletionsdocs/components/content/examples/MotionGroupComponent.vue
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
<script lang="ts" setup></script>

<template>
<div class="example-wrapper">
<div class="example-hint">Scroll down to trigger motion!</div>
<MotionGroup preset="slideVisibleLeft" :duration="600">
<section>
<h3>Product 1</h3>
<p>Description text</p>
</section>
<section>
<h3>Product 2</h3>
<p>Description text</p>
</section>
<section>
<h3>Product 3</h3>
<p>Description text</p>
</section>
</MotionGroup>
</div>
</template>

<style scoped>
.example-wrapper {
height: 200px;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
border: 1px solid #222;
border-radius: 0.5em;
}

.example-hint,
p,
section {
display: flex;
flex-direction: column;

flex: 1 0;
align-items: center;
justify-content: center;

height: 100%;
padding: 2em;
}

section {
background-color: #111;
height: calc(100% / 3);
}

section h3,
section p {
margin: 0.5em !important;
padding: 0 !important;
}
</style>
39 changes: 34 additions & 5 deletionsdocs/content/2.features/7.components.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,21 +4,49 @@ vueuse/motion allows you to implement your animations directly within the templa

These components work similar to the directive `v-motion` usage but work better in projects using server-side rendering.

# `<Motion>`
## `<Motion>`

Example of a `<Motion>` component using a motion preset on a `<p>` element:

```vue
<template>
<Motion is="p" preset="slideVisibleTop">Text in Motion!</Motion>
<Motion is="p" preset="slideVisibleLeft">Text in Motion!</Motion>
</template>
```

<MotionComponent></MotionComponent>

## `<MotionGroup>`

The `<MotionGroup>` can be used to apply motion configuration to all of its child elements, this component is renderless by default and can be used as a wrapper by passing a value to the `:is` prop.

```vue
<template>
<MotionGroup preset="slideVisibleLeft" :duration="600">
<section>
<h3>Product 1</h3>
<p>Description text</p>
</section>
<section>
<h3>Product 2</h3>
<p>Description text</p>
</section>
<section>
<h3>Product 3</h3>
<p>Description text</p>
</section>
</MotionGroup>
</template>
```

<MotionGroupComponent></MotionGroupComponent>


## Props

The `<Motion>`component allowsyou to define animation properties (variants) as props of element.
The `<Motion>`and `<MotionGroup>` components allowyou to define animation properties (variants) as props.

- **`is`**: What element should rendered (`div` by default).
- **`is`**: What element should rendered (`div` by default for `<Motion>`).
- **`preset`**: Motion preset to use (expects camel-case string), see [Presets](/features/presets).

### Variant props
Expand DownExpand Up@@ -59,4 +87,5 @@ These properties apply to `visible`, `visible-once`, or `enter` variants if spec
Content to animate!
</Motion>
</template>
```
```


[8]ページ先頭

©2009-2025 Movatter.jp