visionmedia / move.js

CSS3 backed JavaScript animation framework
http://visionmedia.github.com/move.js/
4.72k stars 686 forks source link

Move multiple elements #34

Closed pyronaur closed 10 years ago

pyronaur commented 10 years ago

First off - thank you for this - an awesome library.

I've found a single inconvenience and right now I can't think of a good solution on my own, so I'm here for help rather than an actual issue of move.js

offset = App.win.height * -1
move('#stage').y( offset ).end()
move('#header').y( offset ).end()

I would rather do

move('#stage, #header').y(App.win.height*-1).end()

I've already added a custom selector engine ( jQuery ), but .get(0) gets only a single element. Is there a way around this ? Maybe it's on the roadmap to support multiple elements ?

yields commented 10 years ago

the problem with multiple elements is that you rarely need to animate them the same way, you can easily do selectors.forEach(function(s){ move(s).y(10).end(); });.

i think the only way to make multiple element support useful is to join data binding to elements like d3 does:

move('li')
.join([....]) // <= data ({ x: N, y: N })
.y(': y * i')
.x(': x * i')
.end();

i'm keeping this open just in case more people need it.