Convert Figma logo to code with AI

Aminerman logovue-kinesis

Easily create complex interactive animations with Vue.js

1,474
59
1,474
25

Top Related Projects

🏆 Swiper component for @vuejs

Hammer.js wrapper for Vue.js

Quick Overview

Vue Kinesis is a lightweight and easy-to-use Vue.js component library for creating interactive animations based on mouse or device movement. It allows developers to add parallax effects, motion tracking, and other dynamic visual elements to their Vue applications with minimal effort.

Pros

  • Simple integration with Vue.js projects
  • Customizable and flexible animation options
  • Responsive design, works well on both desktop and mobile devices
  • Lightweight with minimal performance impact

Cons

  • Limited to Vue.js framework, not usable with other JavaScript libraries
  • May require additional optimization for complex animations on low-end devices
  • Documentation could be more comprehensive for advanced use cases
  • Relatively small community compared to larger animation libraries

Code Examples

  1. Basic Kinesis Container:
<template>
  <kinesis-container>
    <kinesis-element :strength="10">
      <h1>Hello, Vue Kinesis!</h1>
    </kinesis-element>
  </kinesis-container>
</template>

This example creates a simple kinesis container with a moving text element.

  1. Custom Animation Type:
<template>
  <kinesis-container>
    <kinesis-element
      :strength="20"
      type="rotate"
      :max="15"
    >
      <img src="logo.png" alt="Logo" />
    </kinesis-element>
  </kinesis-container>
</template>

This code creates a rotating image that responds to mouse movement.

  1. Multiple Elements with Different Strengths:
<template>
  <kinesis-container>
    <kinesis-element :strength="10">
      <p>Slow moving text</p>
    </kinesis-element>
    <kinesis-element :strength="30">
      <p>Fast moving text</p>
    </kinesis-element>
  </kinesis-container>
</template>

This example demonstrates how to create multiple elements with different movement speeds within the same container.

Getting Started

  1. Install the package:

    npm install vue-kinesis
    
  2. Import and use in your Vue.js application:

import Vue from 'vue'
import VueKinesis from 'vue-kinesis'

Vue.use(VueKinesis)
  1. Use the components in your template:
<template>
  <kinesis-container>
    <kinesis-element :strength="10">
      <p>This element will move!</p>
    </kinesis-element>
  </kinesis-container>
</template>

Competitor Comparisons

🏆 Swiper component for @vuejs

Pros of vue-awesome-swiper

  • More comprehensive and feature-rich slider/carousel solution
  • Better documentation and examples
  • Larger community and more frequent updates

Cons of vue-awesome-swiper

  • Heavier dependency due to Swiper.js integration
  • Steeper learning curve for advanced features
  • Less suitable for simple parallax or mouse-tracking effects

Code Comparison

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <img src="image.jpg" alt="Kinesis element">
  </kinesis-element>
</kinesis-container>

vue-awesome-swiper:

<swiper :options="swiperOptions">
  <swiper-slide>
    <img src="image1.jpg" alt="Slide 1">
  </swiper-slide>
  <swiper-slide>
    <img src="image2.jpg" alt="Slide 2">
  </swiper-slide>
</swiper>

Summary

vue-awesome-swiper is better suited for complex carousel and slider implementations, offering a wide range of features and customization options. It has stronger community support and more frequent updates. However, it comes with a larger footprint and may be overkill for simpler projects.

vue-kinesis, on the other hand, excels in creating lightweight parallax and mouse-tracking effects. It's easier to set up for basic use cases but may lack some advanced features found in vue-awesome-swiper. Choose based on your project's specific requirements and complexity.

Hammer.js wrapper for Vue.js

Pros of vue-touch

  • More established and widely used in the Vue.js ecosystem
  • Focuses on touch events, providing a specialized solution for mobile interactions
  • Offers a broader range of gesture recognitions (tap, swipe, pan, etc.)

Cons of vue-touch

  • Less actively maintained, with fewer recent updates
  • Limited to touch interactions, lacking support for mouse or other input methods
  • May require additional configuration for complex gestures

Code Comparison

vue-touch:

<v-touch v-on:swipeleft="onSwipeLeft" v-on:swiperight="onSwipeRight">
  <div>Swipe me</div>
</v-touch>

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10" type="depth" axis="x">
    <div>Move your mouse</div>
  </kinesis-element>
</kinesis-container>

vue-touch focuses on touch events and gestures, making it suitable for mobile-centric applications. It provides a straightforward way to handle common touch interactions.

vue-kinesis, on the other hand, offers a more versatile solution for creating interactive and responsive elements based on mouse movement or device orientation. It's not limited to touch events and can create engaging visual effects for both desktop and mobile experiences.

While vue-touch is more established, vue-kinesis provides a fresh approach to interactivity that can enhance user engagement across various devices and input methods.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

March 2024: The project has been on standby for a while now. But good news! I'm working on a brand new version, more robust, with better documentation and more features!

What's in preparation:

  • Rewriting everything in TS
  • New interactions
  • A detailed documentation
  • A vanilla TS version

vue-kinesis

npm vue2 vue2

Easy to use Vue.js components for creating interactive animations

Demo

Kinesis Demo

Tutorials

Vue3 - Installation

npm install --save vue-kinesis@next

Vue3 - Default import

Install all the components:

import { createApp } from "vue";
import App from "./App.vue";
import VueKinesis from "vue-kinesis";

const app = createApp(App);
app.use(VueKinesis);

app.mount("#app");

Vue2 - Installation

npm install --save vue-kinesis

Vue2 - Default import

Install all the components:

import Vue from 'vue'
import VueKinesis from 'vue-kinesis'

Vue.use(VueKinesis)

Use specific components:

import Vue from 'vue'
import { KinesisContainer, KinesisElement } from 'vue-kinesis'

Vue.component('kinesis-container', KinesisContainer)
Vue.component('kinesis-element', KinesisElement)

Browser

<script src="vue.js"></script>
<script src="vue-kinesis.min.js"></script>

Usage

How to use

Props

kinesis-container

PropTypeDefault ValueDescription
activeBooleantrueTo enable or disable the interactions
durationNumber1000Speed of the parallax animation in ms
easingString"cubic-bezier(0.23, 1, 0.32, 1)"Easing of the parallax animation
tagStringdivTakes any valid html tag
eventString"move"Event to which the container will react. Possible values are "move" and "scroll"
perspectiveNumber1000Effective for the 'depth' parallax type
audioStringPath towards an audio file
playAudioBooleanStart/Stop the attached audio file

kinesis-element

PropTypeDefault ValueDescription
strengthNumber10Strength of the motion effect
typeString"translate"translate - rotate - scale - scaleX - scaleY - depth - depth_inv
tagString"div"Takes any valid html tag
transformOriginString"center"Similar to the CSS transform-origin property
originXNumber50The motion's origin relative to the container, on the X axis. 50 being the center of the container, 0 the left side, 100 the right side.
originYNumber50The motion's origin relative to the container, on the Y axis. 50 being the center of the container, 0 the top side, 100 the bottom side.
axisStringnullConstrain the movement to one axis. Possible values: "x" - "y"
maxXNumbernullLimit the maximum range of the movement on the X axis
maxYNumbernullLimit the maximum range of the movement on the Y axis
minXNumbernullLimit the minimum range of the movement on the X axis
minYNumbernullLimit the minimum range of the movement on the Y axis
cycleNumber0How many times the movement will repeat

kinesis-audio

PropTypeDefault ValueDescription
audioIndexNumber50To which frequency to react, on a range of integer values that goes from 0 to 127.
strengthNumber10Strength of the motion effect
typeString"translate"translate - rotate - scale - scaleX - scaleY - depth - depth_inv
tagString"div"Takes any valid html tag
transformOriginString"center"Similar to the CSS transform-origin property
originXNumber50The motion's origin relative to the container, on the X axis. 50 being the center of the container, 0 the left side, 100 the right side.
originYNumber50The motion's origin relative to the container, on the Y axis. 50 being the center of the container, 0 the top side, 100 the bottom side.
axisStringnullConstrain the movement to one axis. Possible values: "x" - "y"
maxXNumbernullLimit the maximum range of the movement on the X axis
maxYNumbernullLimit the maximum range of the movement on the Y axis
minXNumbernullLimit the minimum range of the movement on the X axis
minYNumbernullLimit the minimum range of the movement on the Y axis
cycleNumber0How many times the movement will repeat

Migrating from vue-mouse-parallax

Migration from vue-mouse-parallax is quite easy:

Components

  • parallax-container -> kinesis-container
  • parallax-element -> kinesis-element

Props

  • parallaxStrength -> strength
  • animationDuration -> duration

Prop values

  • translation -> translate
  • rotation -> rotate

License

MIT

NPM DownloadsLast 30 Days