Questions tagged [catransaction]

CATransaction allows you to make batch updates to the Core Animation render tree, and it also allows to trigger implicit animations just by setting layer properties inside of a CATransaction.

CATransaction allows you to make batch updates to the Core Animation render tree. It is most used to override default animation timing functions, durations, etc. or to add a completion block to an animation that doesn't expose one explicitly.

CATransaction allows to trigger implicit animations just by setting layer properties inside of a transaction block. Animating the position of a layer in Objective C:

[CATransaction begin];
[CATransaction setAnimationDuration:0.5];
layer.position = newPosition;
[CATransaction commit];

or the same in Swift:

CATransaction.begin()
CATransaction.setAnimationDuration(0.5)
layer.position = newPosition
CATransaction.commit()

For more information, see the Apple Documentation for CATransaction.

76 questions
5
votes
2 answers

Why is my CATransaction not honoring the duration I set?

I'm porting an iPhone app to Mac OS X. This code was being used successfully on the iPhone: - (void) moveTiles:(NSArray*)tilesToMove { [UIView beginAnimations:@"tileMovement" context:nil]; [UIView setAnimationDuration:0.1]; [UIView…
zpasternack
  • 17,838
  • 2
  • 63
  • 81
5
votes
1 answer

CoreAnimation confusion: CATransaction vs CATransition vs CAAnimationGroup?

I've used these three classes several times by separate several times. For example when I want to group several animations (i.e.: CABasicAnimations, etc) to happen simultaneously I first think of CAAnimationGroup, when I want to see a layer change…
nacho4d
  • 43,720
  • 45
  • 157
  • 240
5
votes
1 answer

how to loop several CABasicAnimations contained in a CATransaction block?

Using Obj.-c for iPhone 5.1 in Xcode 4.3.2; I create an array of CALayers, all from the same image. I then wish to apply a CABasicAnimation to each CALayer in the array simultaneously by grouping via CATransactions. This all works one time. …
4
votes
1 answer

sequencing image using core animation, Recieving memory warnings

I am recieving memory warning using 100 of animating images so I tried to use Core Animation instead but that gives me the same problem. This is because I don't know how to use replaceSublayer in my current code UIView* upwardView=[[UIView…
user2787066
3
votes
2 answers

How do I successfully animate multiple CALayers simultaneously?

I'm successfully animating a single layer to alter its position along an arbitrary path on my screen. I'm now attempting to replicate this animation multiple times to give the illusion of something bending round a corner. I put the code inside a…
3
votes
3 answers

CATransaction Delay

How can I set the delay of my implicit animation in core animation? I'm surprised that there is no kCATransactionAnimationDelay.
Daniel Node.js
  • 6,734
  • 9
  • 35
  • 57
3
votes
1 answer

CoreAnimation uncommitted CATranaction NSComboBox

I am populating an NSComboBox with some data from the function below. After it is populated and I try to scroll through the items I get the CATransaction warning. Can anyone shed some light on why this is happening and what I can do to fix it? I…
3
votes
4 answers

CAShapeLayer animation doesn't stay on screen but disappears

I'm trying to draw a animated circle but every segment needs to have another color. Now everything works except that my piece that is just drawed before I call the method again disappears so only the last part stays. I don't want that, I want that…
user1007522
  • 7,858
  • 17
  • 69
  • 113
3
votes
1 answer

SWIFT: +[CATransaction synchronize] called within transaction while decoding HTML entities

I am making an app that fetches JSON content of a blog. The titles of the blog articles are shown in tableView. The titles fetched were HTML encoded. So I decoded them using this code func configureCell(cell: UITableViewCell, atIndexPath indexPath:…
Swapna Lekshmanan
  • 514
  • 10
  • 30
2
votes
1 answer

CALayer Live Resize Poor Performance

I have a UI where the content of an NSCollectionViewItem's View is drawn programmatically through CALayers. I am using a CAConstraintLayoutManager to keep the layot of the sublayers consistent when resizing, but I am getting very poor performance…
Gian Marco Toso
  • 11,676
  • 5
  • 29
  • 38
2
votes
1 answer

CAlayer transform on sublayers flickers with gestures (ipad)

I have a CALayer that contains few other subLayers (CATextLayer actually) I want to apply some transformation on that layer when user do usual gesture on the ipad but it doesn't seem to be working properly. The goal of using the CALayer was to apply…
oberthelot
  • 1,310
  • 1
  • 11
  • 23
2
votes
0 answers

UITableView deleteRows animation bug (it always fade regardless rowAnimation variable)

I'm deleting a row from UITableView with RowAnimation .left which should be very simple by writing the following tableView.deleteRows(at: [indexPath], with: .left), but here comes the problem the UITableView doesn't respect the rowAnimation I'm…
Hazem Badr
  • 41
  • 4
2
votes
0 answers

CATransaction completion block is called twice

I am trying to make CABasicAnimation with a CATransaction, so I can have a Completion handler. It works fine but when I quit the view Controller and come back, the completion block is called twice : Once when the animation starts and once it…
2
votes
1 answer

UIView replicate CAAnimation of another view, in real time?

So I've got a background view with a gradient sublayer, animating continuously to change the colors slowly. I'm doing it with a CATransaction, because I need to animate other properties as well:…
Morpheus
  • 1,189
  • 2
  • 11
  • 33
2
votes
1 answer

How to let CATransaction repeat infinitely? - Swift

I have an animate function which contains CATransaction.begin() I want this animation to be repeated infinitely or for a defined number of times. How do I make that happen? This is the animate function if you need to see the code: private func…
w.y
  • 99
  • 2
  • 11