diff --git a/docs/.vitepress/theme/components/ScrollControlsDemo.vue b/docs/.vitepress/theme/components/ScrollControlsDemo.vue index 683d57a5..cf582d3f 100644 --- a/docs/.vitepress/theme/components/ScrollControlsDemo.vue +++ b/docs/.vitepress/theme/components/ScrollControlsDemo.vue @@ -1,109 +1,21 @@ - - diff --git a/docs/.vitepress/theme/components/ScrollControlsHorizontalDemo.vue b/docs/.vitepress/theme/components/ScrollControlsHorizontalDemo.vue new file mode 100644 index 00000000..b89b108c --- /dev/null +++ b/docs/.vitepress/theme/components/ScrollControlsHorizontalDemo.vue @@ -0,0 +1,21 @@ + + + diff --git a/docs/.vitepress/theme/components/ScrollControlsPagesDemo.vue b/docs/.vitepress/theme/components/ScrollControlsPagesDemo.vue new file mode 100644 index 00000000..ebfc6524 --- /dev/null +++ b/docs/.vitepress/theme/components/ScrollControlsPagesDemo.vue @@ -0,0 +1,25 @@ + + + diff --git a/docs/.vitepress/theme/components/ScrollControlsProgressCameraDemo.vue b/docs/.vitepress/theme/components/ScrollControlsProgressCameraDemo.vue new file mode 100644 index 00000000..a79b76ad --- /dev/null +++ b/docs/.vitepress/theme/components/ScrollControlsProgressCameraDemo.vue @@ -0,0 +1,38 @@ + + + diff --git a/docs/.vitepress/theme/components/ScrollControlsProgressDemo.vue b/docs/.vitepress/theme/components/ScrollControlsProgressDemo.vue new file mode 100644 index 00000000..6fa6aa5e --- /dev/null +++ b/docs/.vitepress/theme/components/ScrollControlsProgressDemo.vue @@ -0,0 +1,38 @@ + + + diff --git a/docs/.vitepress/theme/components/ScrollControlsSlotsDemo.vue b/docs/.vitepress/theme/components/ScrollControlsSlotsDemo.vue new file mode 100644 index 00000000..bd869d55 --- /dev/null +++ b/docs/.vitepress/theme/components/ScrollControlsSlotsDemo.vue @@ -0,0 +1,45 @@ + + + diff --git a/docs/guide/controls/scroll-controls.md b/docs/guide/controls/scroll-controls.md index e9fcc28f..78a4a6e8 100644 --- a/docs/guide/controls/scroll-controls.md +++ b/docs/guide/controls/scroll-controls.md @@ -12,12 +12,18 @@ The `cientos` package create this controls from scratch for you, and comes with To start using it, you just need to import it and play with it. -```vue{4} +```vue{10} + ``` @@ -26,65 +32,103 @@ To start using it, you just need to import it and play with it. Is really important that the Perspective camera is set first in the canvas. Otherwise might break. ::: -By default `ScrollControls` creates a scroll around the canvas and takes the camera as a default for animate, also it comes with a reactive `progress` param that returns a normalized value from 0 (start point) to 1 (end point) you just need to attach it to a v-model. - -```vue{2-5,10} - - -``` +You can use the `horizontal` prop, to makes the scroll horizontal way. -You can use the `horizontal` prop, to makes the scroll horizontal way,. + + + ```vue{4} + ``` With the `pages` prop you can control the length of the scroll, and with the `distance` you can control how much movement is apply to the objects ( you can for example use it with 0 value and use the progress element) -```vue{4-8} +In addition a nice effect could be achieve by using the `smoothScroll` prop like so: + + + + +```vue{8-11} + ``` -But it's not all, you can also pass the `htmlScroll` props and deactivate the custom scroll and use the native html scroll. +By default `ScrollControls` creates a scroll around the canvas and takes the camera as a default for animate, also it comes with a reactive `progress` param that returns a normalized value from 0 (start point) to 1 (end point) you just need to attach it to a v-model. -```vue{5} + + + + +```vue{7,24-25} + ``` +If you don't want to use the default camera movement you can set the distance to 0 a just rely on progress to animate (the progress is not affected by the `smoothScroll` ) + + + + + +But it's not all, you can also pass the `htmlScroll` props this will deactivate the custom scroll and use the native html scroll. + +```vue{1} + +``` + ::: warning - If you set the `htmlScroll` you need to set your html to have content that create scroll. so the `pages` prop will not work - The `htmlScroll` will set the TresCanvas as a fixed background. @@ -94,17 +138,44 @@ But it's not all, you can also pass the `htmlScroll` props and deactivate the cu The elements that you pass as a slot will be affected by the scroll effect, and follow the camera. -```vue{5-7} + + + + +```vue{24-30} + + ``` ## Props @@ -116,3 +187,7 @@ The elements that you pass as a slot will be affected by the scroll effect, and | **smoothScroll** | The smooth factor of the scrolling. | `0.5` | | **horizontal** | Whether the scroll is horizontal or vertical. | `false` | | **htmlScroll** | Whether to use the native HTML scroll. | `false` | + +::: warning +Currently the props are not reactive for this control +::: \ No newline at end of file