visionmedia / move.js

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

Add support for percentage values #69

Closed andrepolischuk closed 8 years ago

andrepolischuk commented 9 years ago

Add percentage values for translate, fix #40

move('.square')
  .to('50%', '25%')
  .end();
yields commented 9 years ago

nice! can we keep the conditionals on one line? otherwise looks good to merge!

andrepolischuk commented 9 years ago

I fixed to one line

A commented 8 years ago

@andrepolischuk good catch! But IMHO checking for percent/px by the type of value looks confusing for users. I think, the better way is to add px to the value only if user hasn't specified units. For example if user set -100% or 20rem we're just passing it. But if user has just set only digits (no matter string it or integer), then we will add px to the value before passing.

Please, can you update behaviour to make it more flexible?

A commented 8 years ago

And one little note — can you move this logic into helper function in the bottom of the file? It's pretty nice place for DRY 'cause of many duplications :D

andrepolischuk commented 8 years ago

Sure

andrepolischuk commented 8 years ago

@shuvalov-anton, I fixed

A commented 8 years ago

Thanks)

iamstarkov commented 8 years ago

👍