最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Usage of velocity.js animations in React - Stack Overflow

programmeradmin0浏览0评论

Can i use velocity.js animations within React ponents without integrating it without velocity-react library ? I don't like that by default, when the ponent is mounted, the final state of the animation is shown. How can i make animation to run on ponent load ?

Can i use velocity.js animations within React ponents without integrating it without velocity-react library ? I don't like that by default, when the ponent is mounted, the final state of the animation is shown. How can i make animation to run on ponent load ?

Share Improve this question edited Sep 2, 2016 at 11:38 Ivica Obadic asked Sep 2, 2016 at 11:02 Ivica ObadicIvica Obadic 751 silver badge10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

simple example:

  1. import velocity

    import Velocity from 'velocity-animate';
    
  2. then start animation in ponentDidMount

    import React, { Component } from 'react';
    class VelocityExample extends Component {
        ponentDidMount(){
             Velocity(this.refs.block,{ scale: 2 },500)
             .then(e=>console.log('animation plete'))
        }
        render(){
            return <div ref="block" >VelocityExample</div>;
        }
    }
    
发布评论

评论列表(0)

  1. 暂无评论