rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.29k stars 864 forks source link

jquery.transit modifies passed object #112

Open skmasq opened 11 years ago

skmasq commented 11 years ago

If found a bug.

If I create obj:

var route= {
    start: {
        webkitOpt: {
            scale: 1,
            translate: [-237, -437],
            rotate: 0
        },
    }
}

and I pass it like this:

jQuery().transition(route.start.webkitOpt)

it overwrites my obj like so:

var route= {
    start: {
        webkitOpt: {
            scale: 1,
            translate: ["translate",-237, -437],
            rotate: 0
        },
    }
}

and after awhile it's like this:

[...]
translate: ["translate","translate","translate","translate","translate",-237,-437]
[...]
dillongrove commented 11 years ago

I'm having a similar problem whereby calling the transition function seems to remove certain properties from the options object. For example, I want to define an animation like this:

var myAnimation = {
    opacity: 1,
    scale: 1,
    easing: "easeIn",
    delay: 150
};

and then call it like this:

$(".foo").transition(myAnimation, 300);

But after calling transition({...}) the object gets changed to:

{
    opacity: 1,
    scale: 1,
};

What's the issue? Why does calling transition modify the passed in object?