Convert Figma logo to code with AI

amineyarman logovue-kinesis

Easily create complex interactive animations with Vue.js

1,488
59
1,488
25

Top Related Projects

Javascript library to create physics-based animations

50,532

JavaScript animation engine

20,011

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web

18,496

The motion graphics toolbelt for the web

2,422

🤹 Vue Composables putting your components in motion

2,728

🎬 Scene.js is JavaScript & CSS timeline-based animation library

Quick Overview

Vue Kinesis is a lightweight Vue.js component library that allows developers to easily create interactive animations based on mouse or device movement. It provides a set of components and directives to create parallax effects, transformations, and other motion-based interactions without complex JavaScript or CSS.

Pros

  • Easy to integrate and use with Vue.js projects
  • Highly customizable with various animation types and properties
  • Responsive and works well on both desktop and mobile devices
  • Lightweight and performant

Cons

  • Limited documentation and examples
  • May require additional optimization for complex animations
  • Dependency on Vue.js framework
  • Might not be suitable for projects requiring more advanced or specific animation needs

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 basic kinesis container with a single element that moves based on mouse movement.

  1. Custom Transformation:
<template>
  <kinesis-container>
    <kinesis-element
      :strength="20"
      type="depth"
      :transformOrigin="'50% 50%'"
    >
      <img src="your-image.jpg" alt="Animated Image" />
    </kinesis-element>
  </kinesis-container>
</template>

This example applies a depth transformation to an image, creating a 3D-like effect.

  1. Multiple Elements with Different Properties:
<template>
  <kinesis-container>
    <kinesis-element :strength="10" type="translate">
      <h2>Translate Me</h2>
    </kinesis-element>
    <kinesis-element :strength="20" type="rotate">
      <p>Rotate Me</p>
    </kinesis-element>
    <kinesis-element :strength="15" type="scale">
      <div>Scale Me</div>
    </kinesis-element>
  </kinesis-container>
</template>

This example demonstrates multiple kinesis elements with different transformation types within a single container.

Getting Started

  1. Install the package:

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

    import Vue from 'vue'
    import VueKinesis from 'vue-kinesis'
    
    Vue.use(VueKinesis)
    
  3. Use the components in your template:

    <template>
      <kinesis-container>
        <kinesis-element :strength="10">
          <p>Your content here</p>
        </kinesis-element>
      </kinesis-container>
    </template>
    
  4. Customize the animation properties as needed using the available props and options.

Competitor Comparisons

Javascript library to create physics-based animations

Pros of dynamics.js

  • Framework-agnostic, can be used with any JavaScript project
  • Focuses on physics-based animations, offering more realistic motion
  • Smaller library size, potentially better performance for simple animations

Cons of dynamics.js

  • Less feature-rich compared to vue-kinesis
  • Requires more manual setup and configuration
  • Not specifically designed for Vue.js integration

Code Comparison

dynamics.js:

dynamics.animate(element, {
  translateX: 100,
  scale: 2
}, {
  type: dynamics.spring,
  duration: 1000
});

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <div>Animated content</div>
  </kinesis-element>
</kinesis-container>

Key Differences

  • vue-kinesis is specifically designed for Vue.js, offering easier integration with Vue components
  • dynamics.js provides more control over animation physics, while vue-kinesis focuses on declarative, component-based animations
  • vue-kinesis offers a wider range of animation types and effects out of the box
  • dynamics.js requires more JavaScript code to set up animations, while vue-kinesis uses a more declarative, template-based approach

Use Cases

  • Choose dynamics.js for:

    • Framework-agnostic projects
    • Precise control over physics-based animations
    • Smaller, focused animation needs
  • Choose vue-kinesis for:

    • Vue.js projects
    • Quick implementation of complex animations
    • Declarative, component-based animation structure
50,532

JavaScript animation engine

Pros of anime

  • More versatile, can be used with any JavaScript project, not limited to Vue.js
  • Larger community and more frequent updates
  • Supports a wider range of animation types and properties

Cons of anime

  • Requires more manual setup and configuration for complex animations
  • Steeper learning curve for beginners
  • May have a larger file size, potentially impacting page load times

Code Comparison

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <div>Animated element</div>
  </kinesis-element>
</kinesis-container>

anime:

anime({
  targets: '.element',
  translateX: 250,
  rotate: '1turn',
  duration: 800,
  easing: 'easeInOutQuad'
});

Summary

vue-kinesis is specifically designed for Vue.js projects, offering easy-to-use components for mouse-based animations. It's ideal for quickly adding interactive elements to Vue applications.

anime is a more general-purpose animation library that can be used in any JavaScript project. It offers greater flexibility and a wider range of animation options but requires more setup and JavaScript knowledge to implement effectively.

The choice between the two depends on the project requirements, the developer's familiarity with Vue.js, and the complexity of the desired animations.

20,011

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web

Pros of GSAP

  • More comprehensive animation capabilities, including complex timelines and advanced easing
  • Broader browser support and better performance optimization
  • Extensive documentation and large community support

Cons of GSAP

  • Steeper learning curve due to its extensive feature set
  • Larger file size, which may impact load times for smaller projects
  • Not specifically designed for Vue.js, requiring additional setup for integration

Code Comparison

GSAP:

import { gsap } from "gsap";

gsap.to(".box", { duration: 1, x: 100, y: 100, rotation: 360 });

vue-kinesis:

<template>
  <kinesis-container>
    <kinesis-element :strength="10">
      <div class="box"></div>
    </kinesis-element>
  </kinesis-container>
</template>

Summary

GSAP offers a more powerful and versatile animation toolkit suitable for complex projects across various frameworks. vue-kinesis, on the other hand, provides a simpler, Vue-specific solution for basic parallax and motion effects. While GSAP excels in animation capabilities and performance, vue-kinesis offers easier integration and a gentler learning curve for Vue.js developers working on smaller projects or those primarily focused on parallax effects.

18,496

The motion graphics toolbelt for the web

Pros of mojs

  • More comprehensive animation toolkit with a wider range of features
  • Language-agnostic, can be used with various frameworks or vanilla JavaScript
  • Larger community and more extensive documentation

Cons of mojs

  • Steeper learning curve due to its extensive API
  • Potentially heavier in terms of file size and performance impact

Code Comparison

mojs:

const burst = new mojs.Burst({
  radius:   { 0: 100 },
  count:    5,
  children: {
    shape:      'circle',
    fill:       { 'cyan' : 'yellow' },
    duration:   2000
  }
});

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <div class="box"></div>
  </kinesis-element>
</kinesis-container>

Key Differences

  • vue-kinesis is specifically designed for Vue.js, while mojs is framework-agnostic
  • mojs offers more complex animations and effects, while vue-kinesis focuses on simpler, mouse-based interactions
  • vue-kinesis has a more declarative, component-based approach, whereas mojs uses a programmatic API

Use Cases

  • Choose mojs for complex, custom animations across various web projects
  • Opt for vue-kinesis when working with Vue.js and needing quick, interactive mouse-based effects

Community and Support

mojs has a larger community and more resources available, while vue-kinesis is more niche but well-suited for Vue.js developers looking for simple interactivity.

2,422

🤹 Vue Composables putting your components in motion

Pros of motion

  • More comprehensive animation capabilities, including spring animations and scroll-based effects
  • Better TypeScript support and type definitions
  • Actively maintained with frequent updates and a larger community

Cons of motion

  • Steeper learning curve due to more complex API
  • Potentially higher bundle size for simpler animation needs

Code Comparison

vue-kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <div>Animated element</div>
  </kinesis-element>
</kinesis-container>

motion:

<template>
  <div v-motion :initial="{ opacity: 0, y: 100 }" :enter="{ opacity: 1, y: 0 }">
    Animated element
  </div>
</template>

Summary

motion offers more advanced animation features and better TypeScript support, making it suitable for complex projects. However, it may be overkill for simple animations. vue-kinesis provides a simpler API for basic mouse-based animations but lacks the versatility of motion. Choose motion for comprehensive animation needs and active development, or vue-kinesis for straightforward mouse-driven effects with a gentler learning curve.

2,728

🎬 Scene.js is JavaScript & CSS timeline-based animation library

Pros of Scene.js

  • More versatile, supporting various animation types beyond just kinetic effects
  • Offers a wider range of features, including timeline controls and easing functions
  • Can be used with multiple frameworks, not limited to Vue.js

Cons of Scene.js

  • Steeper learning curve due to more complex API and features
  • Potentially heavier in terms of file size and performance impact

Code Comparison

Vue Kinesis:

<kinesis-container>
  <kinesis-element :strength="10">
    <div>Animated element</div>
  </kinesis-element>
</kinesis-container>

Scene.js:

import Scene from "scenejs";

const scene = new Scene({
  ".animated": {
    0: { opacity: 0, transform: "translate(0, 0)" },
    1: { opacity: 1, transform: "translate(100px, 100px)" },
  },
});

scene.play();

Summary

Vue Kinesis is a simpler, more focused library for creating kinetic effects in Vue.js applications. It's easier to use for basic animations but limited in scope. Scene.js, on the other hand, offers a more comprehensive animation toolkit that can be used across different frameworks. It provides more advanced features but requires a deeper understanding of its API. The choice between the two depends on the specific project requirements and the developer's familiarity with animation concepts.

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

October 2024: A full TS version is now available KinesisJS. You can use it in your vue projects if you need any of the new features. It works with Vue but a dedicated Vue version is in the works.

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