caanimation

Resume CABasicAnimation backwards by setting .speed equal to -1

雨燕双飞 提交于 2021-02-05 11:38:53
问题 EDIT : i've refactored the question a bit and solved part of the issue, now the question comes down to why does the presentation layer glitches/flashes when the animation is resumed. At this point tho i'm accepting any answer that makes the animation resume both forwards and backwards at will with no issue. I'm not sure the approach i'm using is the right one, i'm still pretty new to Swift. Note : Sample project at the bottom, for having a better understanding of the issue. In my project i'm

Core Animation学习笔记

我的未来我决定 提交于 2020-12-18 00:53:51
Core Animation的基类为CAAnimation,使用起来还是比较简单方便的,可是实现绚丽的动画效果,步骤可分为如下三步 a. 创建一个CAAnimation的子类对象 b. 为该对象添加一些属性 c. 为需要执行该动画视图的layer添加该动画 看一个简单的例程 var aview = UIView(frame: CGRectMake(20, 20, 80, 80)) aview.backgroundColor = UIColor.blackColor() self.view.addSubview(aview) var basicAnimation = CABasicAnimation(keyPath: "transform.scale") basicAnimation.fromValue = 0.5 basicAnimation.toValue = 1.0 basicAnimation.duration = 2.0 basicAnimation.repeatCount = 3 aview.layer.addAnimation(basicAnimation, forKey: "scale") 首先创建了一个CAAnimation的子类CABasicAnimation,由于 CAAnimation为抽象类,需要使用时,需要使用其子类。CAAnimation的类层次图为

wiggle animation in objective C

别来无恙 提交于 2020-01-06 02:46:22
问题 I have multiple animate-able/interactive UIImageViews on my UIView which would animate/interact based on user touches. I am trying to add a feature which would "wiggle" these animate-able/interactive UIImageViews on touch of an Icon which would help user in identifying which objects are interactive on screen. I am trying to use following code to achieve "wiggle" movement from this blog: -(void)doWiggle:(UIView *)touchView { // grabbing the layer of the tocuhed view. CALayer *touchedLayer =

Animation stops after segueing to different view controller

最后都变了- 提交于 2020-01-04 01:49:13
问题 I have an animation in my app that basically just makes a UIButton grow and shrink to make it obvious to the user that they should tap. The problem is that while it works fine when the view first appears, it doesn't work if I go to a different view controller (with a segue) and then return (nothing happens). Here is my code: override func viewWillAppear(animated: Bool) { expandAnimation() } func expandAnimation() { var animation = CABasicAnimation(keyPath: "transform.scale") animation.toValue

UICollectionviewCell Animations

人走茶凉 提交于 2020-01-03 06:21:06
问题 I want to animate the collectionview cells,the animations should be like this: First Cell Appear and then after some delay second cell will appear with some animations ,this will go on like this for all the cells. How to achieve this? 回答1: A solution would be to create the datasource incrementally so you add a cell after a set timed delay. Once added, insert Make a call to set up a timer to add to your dataSource with whatever delay you like [NSTimer scheduledTimerWithTimeInterval:0.05 target

CALayer animation reverts

我怕爱的太早我们不能终老 提交于 2019-12-24 09:25:27
问题 I have been trying to do CALayer animation. But after animation it reverts back.I found a few solutions like removedOnCompleteion = YES and fill mode = kCAFillModesForwards but none is helping me. here is the code. Need a little help fellows thx. void(^ myblock)(NSDictionary *) = ^(NSDictionary *dict){ NSMutableArray *arrOfPt= [dict objectForKey:@"Path"]; CGPoint p1 = [[arrOfPt objectAtIndex:0] CGPointValue]; CGPoint cp1 = [[arrOfPt objectAtIndex:1] CGPointValue]; // CGPoint cp1 = [[arrOfPt

CAAnimation with CALayers occasionally creates flickered animation (video included)

我的梦境 提交于 2019-12-23 23:42:10
问题 My app takes a still photo and animates the mouth region to emulate talking. However, about 1/4 of the time, some of the hidden calayers will flash continuously throughout the animation. Here is what the app looks like when it works properly. Here is what the app looks like when it glitches. EDIT: a better video I'm assuming the issue is path related. In the app, the user creates a path around the mouth region (shown briefly in the video), and this will be the animated region. Sometimes the

When is CALayer.timeOffset ready to be used

江枫思渺然 提交于 2019-12-23 02:20:02
问题 Need some help with an advanced CALayer issue. I have a UIView that adds a CAShapeLayer. The layer is paused (speed = 0), and it has an animation attached that I want to manually control. Very similar to here: Tweening / Interpolating between two CGPaths / UIBeziers - Except my view is a collection view cell. Everything works as expected, except I don't want to start from the 0 position. Each cell might start in a different position in the animation. When the collection view asks me for my

CABasicAnimation - animationDidStop not called

被刻印的时光 ゝ 提交于 2019-12-21 21:32:24
问题 I am making a CABasicAnimation and the problem is that the animationDidStop delegate method does not get called. I am not sure why but hopefully someone knows. Here is my animation: CABasicAnimation *theAnimation; theAnimation = [CABasicAnimation animationWithKeyPath: @"transform.translation.x"]; theAnimation.duration = 54; //theAnimation.repeatCount = 6; theAnimation.autoreverses = YES; theAnimation.removedOnCompletion = YES; theAnimation.fromValue = [NSNumber numberWithFloat: (self