Comments (12)
The image can appear inverted if values go negative. This typically arises when a spring animation is seeded with a large negative velocity and overshoots it's destination. This doesn't appear to be the case with the above code, but could still be possible.
Could you enable tracing on your animation (see https://github.com/facebook/pop/blob/master/README.md#debugging) and post back with the output when your image is inverted?
from pop.
Okey, here is the log I got from the tracer:
2014-05-17 01:15:42.217 TestFacebookPop[42592:60b] events:(
"<POPAnimationEvent:0.000000; type = didStart; animation = <POPSpringAnimation:0x8d8a0e0; from = (0.800, 0.800); to = (1.000, 1.000); currentValue = (0.800, 0.800); progress = 0.000000>>",
"<POPAnimationEvent:0.016667; type = write; value = NSSize: {0.8108772, 0.8108772}; velocity = NSSize: {1.2831588, 1.2831588}>",
"<POPAnimationEvent:0.033952; type = write; value = NSSize: {0.83982837, 0.83982837}; velocity = NSSize: {2.0338047, 2.0338047}>",
"<POPAnimationEvent:0.050218; type = write; value = NSSize: {0.87527531, 0.87527531}; velocity = NSSize: {2.2711141, 2.2711141}>",
"<POPAnimationEvent:0.067286; type = write; value = NSSize: {0.91186851, 0.91186851}; velocity = NSSize: {2.1786273, 2.1786273}>",
"<POPAnimationEvent:0.083950; type = write; value = NSSize: {0.94449908, 0.94449908}; velocity = NSSize: {1.8891594, 1.8891594}>",
"<POPAnimationEvent:0.100619; type = write; value = NSSize: {0.97261453, 0.97261453}; velocity = NSSize: {1.4848927, 1.4848927}>",
"<POPAnimationEvent:0.117283; type = write; value = NSSize: {0.99337238, 0.99337238}; velocity = NSSize: {1.0666399, 1.0666399}>",
"<POPAnimationEvent:0.117283; type = didReachToValue; value = NSSize: {1.0068176, 1.0068176}; velocity = NSSize: {0.70259351, 0.70259351}>",
"<POPAnimationEvent:0.133265; type = write; value = NSSize: {1.0068176, 1.0068176}; velocity = NSSize: {0.70259351, 0.70259351}>",
"<POPAnimationEvent:0.150636; type = write; value = NSSize: {1.015615, 1.015615}; velocity = NSSize: {0.36775044, 0.36775044}>",
"<POPAnimationEvent:0.167295; type = write; value = NSSize: {1.0194494, 1.0194494}; velocity = NSSize: {0.11604345, 0.11604345}>",
"<POPAnimationEvent:0.183954; type = write; value = NSSize: {1.0198306, 1.0198306}; velocity = NSSize: {-0.056457963, -0.056457963}>",
"<POPAnimationEvent:0.200622; type = write; value = NSSize: {1.0178879, 1.0178879}; velocity = NSSize: {-0.16628926, -0.16628926}>",
"<POPAnimationEvent:0.217301; type = write; value = NSSize: {1.0146939, 1.0146939}; velocity = NSSize: {-0.21739487, -0.21739487}>",
"<POPAnimationEvent:0.233981; type = write; value = NSSize: {1.0110993, 1.0110993}; velocity = NSSize: {-0.22687726, -0.22687726}>",
"<POPAnimationEvent:0.250622; type = write; value = NSSize: {1.0074533, 1.0074533}; velocity = NSSize: {-0.20806593, -0.20806593}>",
"<POPAnimationEvent:0.267314; type = write; value = NSSize: {1.0043283, 1.0043283}; velocity = NSSize: {-0.17327371, -0.17327371}>",
"<POPAnimationEvent:0.283812; type = write; value = NSSize: {1.0019022, 1.0019022}; velocity = NSSize: {-0.13316751, -0.13316751}>",
"<POPAnimationEvent:0.300622; type = write; value = NSSize: {1.000042, 1.000042}; velocity = NSSize: {-0.091179259, -0.091179259}>",
"<POPAnimationEvent:0.317096; type = write; value = NSSize: {0.99887323, 0.99887323}; velocity = NSSize: {-0.055046313, -0.055046313}>",
"<POPAnimationEvent:0.333710; type = write; value = NSSize: {0.99824363, 0.99824363}; velocity = NSSize: {-0.026304759, -0.026304759}>",
"<POPAnimationEvent:0.350623; type = write; value = NSSize: {0.99800551, 0.99800551}; velocity = NSSize: {-0.0037051465, -0.0037051465}>",
"<POPAnimationEvent:0.366993; type = write; value = NSSize: {0.99807096, 0.99807096}; velocity = NSSize: {0.010766619, 0.010766619}>",
"<POPAnimationEvent:0.383981; type = write; value = NSSize: {0.99833596, 0.99833596}; velocity = NSSize: {0.019404976, 0.019404976}>",
"<POPAnimationEvent:0.400641; type = write; value = NSSize: {0.99869156, 0.99869156}; velocity = NSSize: {0.022592258, 0.022592258}>",
"<POPAnimationEvent:0.400641; type = write; value = NSSize: {1, 1}; velocity = NSSize: {0.022592258, 0.022592258}>",
"<POPAnimationEvent:0.400641; type = didStop; animation = <POPSpringAnimation:0x8d8a0e0; from = (0.800, 0.800); to = (1.000, 1.000); velocity = (0.023, 0.023)>; value = 1; velocity = NSSize: {0.022592258, 0.022592258}>"
)
from pop.
The animation looks like it's doing what I would expect based on your sample code. And there are no negative values which means something else must be going on. Do you mind creating a little sample app that reproduces and I can have a look?
from pop.
Thanks!
The demo project is here: https://github.com/JmeHsieh/TestFacebookPop
from pop.
Ah, I found the issue. You're attaching an animation with the property kPOPLayerScaleXY
to a UIButton
. Because it's kPOPLayer...
, it should be attached to a CALayer
instead, like this:
[object.layer pop_addAnimation:spring forKey:@"anything"];
That fixes the animation when I made the change in your demo app.
from pop.
You are right!
Didn't realize such difference, thanks guys.
from pop.
I've just had this problem too, posting here in case anyone else requires a solution:
This issue inspired the solution. It was in fact what @kimon mentioned -> "The image can appear inverted if values go negative". Changing the animation from a POPSpringAnimation
to a POPBasicAnimation
when animating the layer's scale back to 0 meant that the value never hit negative and therefore remained in the correct orientation. Didn't actually make sense using a spring animation come to think of it.
from pop.
I was having what seems to be the same problem. I clamped the end of the animation and animated to .05 instead of 0. I tried the basic animation but the curve didn't seem right.
It'd probably make sense for the framework to handle a 0 scale since it seems to be a really common case.
from pop.
Same here, 0 is breaking the animation.
@grp I have the problem adding this type fo animation on a uilabel. The animation is added on the uilabel layer, as it should be
Is there something that you could be aware about it ? (or that I should be aware of)
from pop.
I would expect it would flip — springs animate past their final values before settling, and a negative scale is flipped. Usually, the easiest way to avoid this is by setting the clampMode
on the animation so it doesn't go past the end.
from pop.
@grp can as ask you an example of this use ?
from pop.
@bbnnt I was able to fix this by setting my animation's clampMode
property to kPOPAnimationClampEnd
. My animation was scaling a button's layer down to 0 and the spring must have caused the negative values.
from pop.
Related Issues (20)
- paper link does not exist
- Couldnt be able to integrate this with Swift 3.0 project by following the same commands. HOT 1
- No such file or directory error while building the workspace
- Errors should be thrown when animation parameters don't match animation parameters
- In memory of the Facebook Paper HOT 1
- Why not kPOPLayerRotationZ this enumeration? I want to rotate the animation around the Z axis. HOT 2
- Cannot works with Snapkit?
- Do you have the scenekit+pop demo?
- iostream file not found - Xcode 9.3.1 - Swift 4 HOT 3
- How to get the progress of the animation
- _POPPropertyAnimationState isPaused reset the progress
- Installation
- CocoaPods update HOT 5
- If toValue equals the target's current value then completionBlock will fire immediately HOT 1
- Carthage issue HOT 1
- problem with same animation HOT 1
- i feel confused ,what the function work for ‘ [self _scheduleProcessPendingList]’
- POPSpringAnimation removedOnCompletion not working
- Spring animation not working anymore following iOS 13 update HOT 5
- Swift Package Manager Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pop.