Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
1.3 KiB
Markdown
59 lines
1.3 KiB
Markdown
---
|
|
category: Sensors
|
|
---
|
|
|
|
# useParallax
|
|
|
|
Create parallax effect easily. It uses `useDeviceOrientation` and fallback to `useMouse` if orientation is not supported.
|
|
|
|
## Usage
|
|
|
|
```vue
|
|
<script setup lang="ts">
|
|
import { useParallax } from '@vueuse/core'
|
|
|
|
const container = ref(null)
|
|
const { tilt, roll, source } = useParallax(container)
|
|
</script>
|
|
|
|
<template>
|
|
<div ref="container" />
|
|
</template>
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export interface UseParallaxOptions extends ConfigurableWindow {
|
|
deviceOrientationTiltAdjust?: (i: number) => number
|
|
deviceOrientationRollAdjust?: (i: number) => number
|
|
mouseTiltAdjust?: (i: number) => number
|
|
mouseRollAdjust?: (i: number) => number
|
|
}
|
|
export interface UseParallaxReturn {
|
|
/**
|
|
* Roll value. Scaled to `-0.5 ~ 0.5`
|
|
*/
|
|
roll: ComputedRef<number>
|
|
/**
|
|
* Tilt value. Scaled to `-0.5 ~ 0.5`
|
|
*/
|
|
tilt: ComputedRef<number>
|
|
/**
|
|
* Sensor source, can be `mouse` or `deviceOrientation`
|
|
*/
|
|
source: ComputedRef<"deviceOrientation" | "mouse">
|
|
}
|
|
/**
|
|
* Create parallax effect easily. It uses `useDeviceOrientation` and fallback to `useMouse`
|
|
* if orientation is not supported.
|
|
*
|
|
* @param target
|
|
* @param options
|
|
*/
|
|
export declare function useParallax(
|
|
target: MaybeElementRef,
|
|
options?: UseParallaxOptions,
|
|
): UseParallaxReturn
|
|
```
|