-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stop/start pulse #11
Comments
Hey junhohong, what exactly do you try to achieve? There are several ways to do so or fake that effect. Currently I have no pause and resume method implemented. But you could set the alpha of the animation to zero, set it to hidden, removeAllAnimations of the element that uses that and reattach it again. I can try to implement pause and resume if I get some free time, but won't be able to do it quickly. |
I'm trying to activate the pulse on a longtap gesture and remove the pulse when the touch is released. |
Do I call removeAllAnimations on the layer it's attached to or the actual imageView? Also, how would I reattach? .insertSublayer? |
Thanks for getting back to me so fast btw. |
Cannot test it in person right now but the whole thing is a subclass of CALayer. So if you keep a reference to the pulsing CALayer you should be able to remove that specific layer from the view it's lying on. Basically on touchRelease you could do pulseReference.removeFromSuperLayer. That's a guess in the wild, but should work in theory. Let me know! |
I've actually tried that and it does successfully remove the pulse. However my problem is starting up the animation again - I've tried initializing the animation again and inserting it to the sublayer, keeping the same animation and inserting it to the sublayer -- both did not work :( |
That's weird. Could you attach a code example? I would think at least reinirializing it again and add it as a sublayer should work properly. |
On longhold:
On release: |
Exiting and entering the app again makes it work, could be a lead |
could you please try the following: Save the reference to the pulse effect and then do the following: So don't traverse through layer hierarchy and remove every sublayer but just the pulseEffect layer. |
I've tried that as well, same effect :( |
I am on the run so can't look deeper into it. But it's a standard CALayer, whatever is wrong there should also not work with a normal CALayer. Did you try it with a simple CALayer if it behaves the same? |
Thanks for helping out. I'll try that. |
Simple CALayer behaves the same... |
Figured it out!!!! One of my other animations was interfering with it for some reason. |
Happy that you could resolve the problem! Happy coding! |
Is there a way to stop and restart the pulse?
The text was updated successfully, but these errors were encountered: