Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#9771 closed defect (fixed)

Cannot set both x and y background-position property on dojo.animateProperty

Reported by: Tom Elliott Owned by: dante
Priority: high Milestone: 1.5
Component: General Version: 1.3.2
Keywords: Cc:
Blocked By: Blocking:

Description

Using Dojo 1.3 from the AOL CDN. Testing on Safari 4 and FF3.5.2

background-position requires two parameters (for x and y). AFAICT dojo.animateProperty accepts only a single argument. So you can animate the x values, but not the y.

I can't find another bug relating this, apologies if this is a dup.

Tom

Change History (6)

comment:1 Changed 10 years ago by dante

Milestone: tbdfuture
Owner: changed from anonymous to dante

this is "possible" with dojox.fx._Line (a multidimensional dojo._Line instance) but nearly impossible to sneak into dojo.animateProperty. You can make a raw dojo.Animation and accomplish this

var anim = new dojo.Animation({ 
    curve: new dojox.fx._Line([startx, starty], [endx, endy]),
    onAnimate: function(x, y){
        dojo.style(node, "backgroundPosition", x + "px " + y + "px")
    }
}).play();

but that is hardly elegant.

comment:2 Changed 10 years ago by dante

fwiw, there is actually a test showing how to do this in dojox/fx/tests/

comment:3 Changed 10 years ago by Tom Elliott

Thanks dante.

For anyone else reading this the test is: http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/fx/tests/example_backgroundPosition.html

I'll go have a play.

Tom

comment:4 Changed 9 years ago by praetoriansentry

I ran into this same problem, I found the example at the link a little confusing if all you want to do is animate the y value of the background position. This seemed a little clearer since you don't have to use dojox.fx._Line

var anim = new dojo.Animation({
    duration: 7500, 
    curve: [0, 300],
    onAnimate: function(y){
        dojo.style("theNode", "backgroundPosition", "0px " + y + "px");
    }
}).play();

comment:5 Changed 9 years ago by dante

Milestone: future1.6
Resolution: fixed
Status: newclosed

this has solutions in dojox. eg: dojox.fx._Line and the multiproperty dojo.animateProperty support provided by dojox.html

comment:6 Changed 9 years ago by bill

Milestone: 1.61.5
Note: See TracTickets for help on using tickets.