I'm using the meteor famous-views package and have a surface that is draggable in X using a GenericSync
that registers a session var (dragPosition
)
At the moment the translation is a 1:1 linear correspondence but I would like it to have an easing curve applied given a start position of [0,0]
and limit (for now Math.round window.innerWidth/2
) eg. 500
This coffeescript doesn't work but I think shows what I want to do. I understand why it doesn't work as the easing curve method has no understanding of where it is but how do provide that data and spit back a Famous.Transform.translate
value that has the curve applied?
Template.test5.helpers
'dragTransform': ->
position = Session.get 'dragPosition'
absPosX = Math.abs position[0]
limX = Math.round (window.innerWidth * 0.5)
if absPosX < limX
position[0] = position[0]
else
position[0] = Math.sign(position[0]) * limX
transX = Famous.Transform.translate(position[0],position[1],0),
curve: Famous.Easing.inCirc
Famous.Transform.multiply transX