ios - How can I animate the height of a CALayer with the origin coming from the bottom instead of the top? -


i want animate simple calayer move , down in response incoming data (bars on graphic equaliser)

the calayer should remain fixed along bottom , move , down height animated.

can advise on best way achieve without having animate origin y coord height?

if want layer grow , shrink bottom, should set own anchorpoint on layer bottom. anchor point specified in layers unit coordinate space both x , y range 0 1 inside of bounds, no matter size.

yourlayer.anchorpoint = cgpointmake(0.5, 1.0); 

then animation, animate bounds (or better, can animate "bounds.size.height", since height changing):

// set new bounds of yourlayer here...  cabasicanimation *grow = [cabasicanimation animationwithkeypath:@"bounds.size.height"]; grow.fromvalue = @0;   // no height grow.tovalue   = @200; // height of 200 grow.duration  = 0.5; // add additional animation configuration here... [yourlayer addanimation:grow forkey:@"grow height of layer"]; 


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -