velocity.js progress callback function not working

I have used velocity.js to animate something on page but in progress callback function does not working for me. I am getting null value for the tweenValue para.

Here is the code.

$element.velocity({
    opacity: 0,
    tween: 1000 // Optional
}, {
    progress: function(elements, complete, remaining, start, tweenValue) {
        console.log((complete * 100) + "%");
        console.log(remaining + "ms remaining!");
        console.log("The current tween value is " + tweenValue)
    }
});

Answers


Your example works fine when I try it on the document body,

$("body").velocity({
    opacity: 0,
    tween: 1000 // Optional
}, {
    progress: function p(elements, complete, remaining, start, tweenValue) {
        console.log((complete * 100) + "%");
        console.log(remaining + "ms remaining!");
        console.log("The current tween value is " + tweenValue)
    }
});

It logs messages like the following

4%
VM740:8 384ms remaining!
VM740:9 The current tween value is 3.942649342761062

I used the latest 1.2.2 version from github, https://github.com/julianshapiro/velocity/blob/master/velocity.js and I used requirejs to load velocity and jquery in the page


Need Your Help

iOS Tap gesture state begin doesn't hit

ios cocoa-touch

I have made a view clickable with a tap gesture recognizer, which is working just fine. But I want to highlight the view when the touch happens en remove it when the touch ended.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.