This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Cyrus Cheng
Posted Mar 31 - Read on Facebook

why i use move animation like this:
layerA.animation
properties:
x:a
y:b
but the layerA.x is not really change to "a"
when i use layerA.x="a", it's x change to "a",but it will not have any animation.
dose framer have any way to add an animation to a x or y propertie change?
by the way ,i know the way layerA.states.add...,but this can't resolve some question...

10 Comments

Jacky Lee

Use layerA.animate

Cyrus Cheng

i mean it will not change layerA.x value...

Benjamin Den Boer

Hey Cyrus Cheng - you can indeed use layerA.animate. See this example, which animates the X and Y properties and prints the change in X for you: http://share.framerjs.com/q6dm9m6yxvlv/

Cyrus Cheng

Benjamin Den Boer Hi, i add one line in ur exp like this:
layerA.animate
properties:
x: 300
y: 300
curve: "spring(300,20,0)"

layerA.on "change:x", ->
____print layerA.x
print layerA.x
it will print layerA.x=50,but layer.animation move layerA to 300,it don't change layerA.x value actually...

Benjamin Den Boer

Hey Cyrus Cheng - it does change the x value, but you're printing the x value at initialisation (before it starts animating). The x value of layerA is 50. It animates to 300. If we want the final value, we can also listen to the animationEnd event, like this:

layerA.on Events.AnimationEnd, ->
____print this.x

See also: http://share.framerjs.com/rymd8qtkl04q/

Cyrus Cheng

Benjamin Den Boer o... i see,dose it mean when i use
layerA.on "change:x", ->
it will change layerA.x value when layerA.x change?
i haven't found any information in framer docs, can u give some information about method layer.on events"ch__ange"?

Benjamin Den Boer

It won't change the x value for you. The animation changes the value of the x, the "change:x" function only allows you to see/print the values while it's animating/changing.

Cyrus Cheng

Benjamin Den Boer so..it mean layer.animation will change layer.x's value? what if i need use the value of layerA.x's value Immediately after layer.animation? only use layerA.on events.animationend, ->?

Benjamin Den Boer

Cyrus Cheng - yes, that would work.
See: http://share.framerjs.com/xrwfevzp2o11/

Cyrus Cheng

Benjamin Den Boer thanks...i see

Read the entire post on Facebook