CABasicAnimation enter foreground(repeatCount = 5). Add animation again, this animation will run twice. If not, this animation will not disappear when done and don't carry out animationDidStop.
However, a month has passed.Like the reply above, i answered myself! Briefly, every 5 seconds, the number of cycles is decremented by one, by using NSTimer.
Related
I have an unusual error. I have one slide with 10 trigger animations. Each animation last 2 seconds. The shapes that trigger the animation also runs a delay macro to hide the same shape based on few conditions (hence, can't use a disappear trigger animation as its disappearance is conditional).
lag = 3
start = Timer
While Timer < Start + lag
DoEvents
Wend
If disappear = True then oSh.Visible = msoFalse
The entire sequence works when I have only one slide in my presentation. As soon as I add more slides (even if it is just 1 blank slide), the animation becomes abrupt and doesn't look as intended. It looks like I'm seeing 1 frame per second.
I had encountered a similar issue earlier where the animations were compromised when a VBA Timer was run. However, I am unable to figure out why it works perfectly when I have only one slide.
Here is a video showcasing it.
I'm making custom UI element and I need to animate it. The problem is that at some point I need to update my animation, but when I update it, there is a visible lag/gap between current animation position (state) and new animation.
In other words, when I'm applying new animation, this animation starts from 0 position (state), while the actual (visible) state of the previous animation is different.
Here is example: (link)
<blockquote class="imgur-embed-pub" lang="en" data-id="a/q3NA31f"></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
Code for animation:
CABasicAnimation *anim = [CABasicAnimation animationWithKeyPath:#"transform.rotation"];
anim.duration = time;
anim.repeatCount = INFINITY;
anim.fromValue = from;
anim.byValue = by;
[self.myLayer addAnimation:anim forKey:kActivityAnimationKey];
First applied animation have different time/from/by parameters.
ANY advices will be much appreciated, since I stuck on it on two days and tried everything that comes to head by this time.
I was able to finish this task and I will give a general answer to this question.
If you want to update your current ongoing animation, but you're in the middle of it, you need to replace current animation with animation that will end current animation on the right place.
For example, in my question there is an animation that have fromValue and byValue. It means, that if you'll start the same animation with different duration, it will change its current rotation state to fromValue.
To fix this behaviour, we need to add animation that will finish our animation from current rotation state to fromValue. To get your current rotation, or other property you need to animate, we have presentationLayer of CALayer. We can set the values from it to our "closing" animation.
How we can know when our closing animation is ended? The answer is CAAnimationDelegate. Just set up a delegate to the closing animation and when it's done - add another animation with different parameters. You can seamlessly update your animation now.
Keep in mind that closing animation time must be a fraction of your original animation time to make things smooth. You can calculate it like this: (end state - current state) * original duration.
By default, it appears that a radial CCProgressTimer starts by displaying its entire sprite and removes a portion of the sprite in counterclockwise fashion.
Is there a way to have the timer begin by displaying nothing and display more and more of the sprite as the timer progresses to completion?
Yes. Start with percentage = 100 and count down to 0.
I'm using a slider to resize some thumbnails in an app. I've set the slider to continuous so it updates as you move the slider instead of when you finish moving it. Works great, except for one thing:
The view that contains the thumbnails the slider resizes in in a split view. When the user starts sliding, i want to maximize said splitview for better usability. The only issue is, while the slider is being moved, it appears to be blocking any resizing operations of the UI. Anyone know how I can un-block it?
Or perhaps know of a different approach?
I figured it out!
Dragging the slider changes the run loop mode. I was maximizing my split view using an animation which has an NSTimer as it's backbone. I was adding the timer to the default run loop mode, when i should have been doing this:
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
A simple question here for many of you. I have an indeterminate NSProgressIndicator which I start and stop many times in my code. Does it reset when you call restart it, or do you have to manually do that? If you do have to do it manually, how would I go about doing it?
Many thanks,
jrtc27
There's no concept of resetting an indeterminate spinner... It's indeterminate. Which aspect of the spinner do you want to reset???