Getting Started with KendoVue Animation

The KendoVue Animation uses the TransitionGroup component to animate elements which appear, enter, or exit the viewport.

The KendoVue Animation component is part of the KendoVue library of Vue UI components. It is distributed through NPM under the kendo-vue-animation package.

Basic Usage

The following example demonstrates the Fade, Expand, Push, Reveal and Slide Animation in action.

<style>
 .content {
   width: 100px;
   padding: 10px;
   color: #787878;
   background-color: #fcf7f8;
   font-size: 13px;
   font-family: Helvetica, Arial, sans-serif;
   letter-spacing: 1px;
   text-align: center;
   border: 1px solid rgba(0,0,0,.05);
 }
 .k-radio-label {
     line-height: 1.2;
     margin-bottom: .5rem;
 }
 </style>
<div id="vueapp" class="vue-app">
 <div class="example-wrapper row">
               <div class="col-xs-12 col-sm-6 example-col">
                    <Expand  v-if="animationType === 'expand'">
                        <div v-if="show" class="content">
                           Content
                           </div >
                   </Expand>
                   <Fade v-else-if="animationType === 'fade'">
                        <div v-if="show" class="content">
                           Content
                           </div >
                   </Fade>
                   <Push v-else-if="animationType === 'push'">
                        <div v-if="show" class="content">
                           Content
                           </div >
                   </Push>
                   <Reveal  v-else-if="animationType === 'reveal'">
                        <div v-if="show" class="content">
                           Content
                           </div >
                   </Reveal>
                   <Slide  v-else="animationType === 'slide'">
                        <div v-if="show" class="content">
                           Content
                           </div >
                   </Slide>
               </div>
               <div class="col-xs-12 col-sm-6 example-config">
                   <input
                       @click="handleSelect"
                       id="slide"
                       class="k-radio"
                       name="type"
                       type="radio"
                       value="slide"
                       :checked="true"
                   />
                   <label for="slide" class="k-radio-label">
                       &nbsp;Slide
                   </label>
                   <br />
                   <input
                       @click="handleSelect"
                       name="type"
                       id="push"
                       class="k-radio"
                       type="radio"
                       value="push"
                   />
                   <label for="push" class="k-radio-label">
                       &nbsp;Push
                   </label>
                   <br />
                   <input
                       @click="handleSelect"
                       name="type"
                       id="expand"
                       class="k-radio"
                       type="radio"
                       value="expand"
                   />
                   <label for="expand" class="k-radio-label">
                       &nbsp;Expand
                   </label>
                   <br />
                   <input
                       @click="handleSelect"
                       name="type"
                       id="fade"
                       class="k-radio"
                       type="radio"
                       value="fade"
                   />
                   <label for="fade" class="k-radio-label">
                       &nbsp;Fade
                   </label>
                   <br />
                   <input
                       @click="handleSelect"
                       name="type"
                       id="reveal"
                       class="k-radio"
                       type="radio"
                       value="reveal"
                   />
                   <label for="reveal" class="k-radio-label">
                       &nbsp;Reveal
                   </label>
                   <br />
                   <button class="k-button" type="submit" @click="animate">Animate</button>
               </div>
           </div>
</div>
import { Expand, Fade, Push, Reveal, Slide } from '@progress/kendo-vue-animation';
Vue.component('Expand', Expand);
Vue.component('Fade', Fade);
Vue.component('Push', Push);
Vue.component('Reveal', Reveal);
Vue.component('Slide', Slide);

new Vue({
    el: '#vueapp',
    data: function () {
        return {
             animationType: 'slide',
             show: false
        };
    },
    methods:{
        animate(){
             this.show = !this.show;
        },
        handleSelect(event) {
            this.animationType = event.target.value;
        }
    }
});

Functionality and Features

The Push Animations further extend the Animation component, which is commonly inherited by all Animation types, and enable you to stack animations.

Installation

  1. Download and install the package. Use Node.js v5.0.0 or later.

    npm install --save @progress/kendo-vue-animation
  2. Once installed, import the package module.

    // ES2015 module syntax
    import { Fade } from '@progress/kendo-vue-animation';
    // CommonJS format
    const { Fade } = require('@progress/kendo-vue-animation');
  3. You are required to install one of the Kendo UI themes to style your components. For more information on how to add the styles, refer to the article on getting started.

Dependencies

The Animation package requires you to install the following peer dependencies in your application:

  • vue 2.6.11*
  • vue-class-component 7.0.2*

In this article