Questions tagged [core-animation]

Core Animation is Apple's framework for performing hardware-accelerated animation of display elements on the Mac and iOS devices. Useful references include Core Animation Programming Guide Animation Types and Timing Programming Guide Core Animation Cookbook

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

How do the parameters of interpolatingSpring() work

I am trying to build a spring animation in SwiftUI that can carry over the velocity of a pan gesture. For this I am using the following initializer. static func interpolatingSpring( mass: Double = ...
Balázs Vincze's user avatar
0 votes
1 answer
30 views

Rotate a UILabel by 360 degrees or a rotation animation [duplicate]

As I am beginner to core animations. I am trying to rotate a label by 360 degrees with repetition or you can say in a continues circular motion. func rotateLabel() { UIView.animate(...
Hamid Raza's user avatar
0 votes
1 answer
30 views

Unable to Apply Colors to CAGradientLayer in Swift

class ViewController: UIViewController { let label = UILabel() private var rightGradient: CAGradientLayer! let view2 = UIView() override func viewDidLoad() { super....
StrongMan's user avatar
0 votes
1 answer
13 views

Importance of CABasicAnimation key name

I wonder what's the importance of the key when adding CABasicAnimation to a layer. I have several views visible at the same time. To each I apply a function so that it is animated. In summary this ...
Bejil's user avatar
  • 412
2 votes
2 answers
118 views

Snake like animation on the rounded rectangle path

I'm trying to implement an animation similar to what you can see on the image: I'm using the Core Graphics and Core Animation with UIBezierPath to achieve this, but the problem seems to be with the ...
lawicko's user avatar
  • 7,264
1 vote
0 answers
57 views

UIViewPropertyAnimator: "Fast" timing parameters and/or low animation duration causes scrubbing to snap between values at the start

I've been playing around with the awesome UIViewPropertyAnimator, but are observing something during scrubbing I don't quite understand. Linearly scrubbing a UIViewPropertyAnimator configured with &...
thomsmed's user avatar
  • 151
0 votes
1 answer
318 views

How to Render Content of CALayer on a Background Thread

I am implementing a CALayer that needs to perform drawing on the background thread. However, despite setting the property "drawsAsynchronously" to true, the draw function is still being ...
Brew Master's user avatar
0 votes
1 answer
38 views

UIBezierPath CAAnimation finishes too fast when startAngle changed

This code will draw a circle at 3'oclock. The duration is set to 10 seconds, and it visually lasts 10 seconds. However, I want the starting angle to appear at 12 o'clock, instead of 3 o'clock. If I ...
Lena Verhoev's user avatar
0 votes
0 answers
20 views

Unable to animate views from modal sheet

MRE struct ContentView: View { @Namespace var namespace @State var show = false var body: some View { VStack { Rectangle() .fill(.blue) ...
erotsppa's user avatar
  • 14.3k
1 vote
2 answers
52 views

Simple SKScene randomly drops to 40fps

I have a simple SKScene generated in code that gets presented from a SKView in a storyboard. This scene contains a single 30x18 pixel art image, no animations, no updates. For some reason, such a ...
David's user avatar
  • 79
0 votes
1 answer
77 views

swift animateKeyframes withRelativeStartTime not working

I want to achieve an animate: Each cell rightImage move first, and after rightImage moved, the backgroundImage(which is a gif) start to animating. However, the moving animation and gif startAnimating ...
malcopolocei's user avatar
0 votes
1 answer
305 views

How can I create a ChatGPT print Animation in SwiftUI?

I have created a small ChatGPT clone using SwiftUI to communicate with his/her API. How I can create a print-style animation when the response comes from the API? struct ContentView: View { @...
NinjaDeveloper's user avatar
0 votes
0 answers
96 views

How to use CAPluginLayer & CABackdropLayer?

I was looking in internet for learning about CAPluginLayer & CABackdropLayer I found this link here are some codes like this: let layer = CAPluginLayer() layer.frame = CGRect(x: 50, y: 50, width: ...
ios coder's user avatar
1 vote
1 answer
60 views

How to access the calculated small values of animation in Core Animation?

I am using this below code for my animation: let animation = CABasicAnimation() animation.keyPath = "position.x" animation.fromValue = 0 animation.toValue = 300 animation.timingFunction = ....
ios coder's user avatar
0 votes
0 answers
70 views

How can I access the NSWindow CALayer?

If we want to animate a window we can use open func setFrame(_ frameRect: NSRect, display displayFlag: Bool, animate animateFlag: Bool). Or for more control we can use the same function inside an ...
ios coder's user avatar
0 votes
1 answer
31 views

Changing a CAShapeLayer's bounds size height doesn't change the actual size, it changes it's position

A CAShapeLayer is added as a sublayer of a view in a certain position: // Use Bezier Path to create a rectangle shape let barRect = CGRect(x: 0, y: 0, width: 10, height: 100) let barPath = ...
caminante errante's user avatar
0 votes
1 answer
58 views

How to make a gradient of View Border color?

private let containerView: UIView = { let view = UIView() var gradientBorderLayer: CAGradientLayer? view.translatesAutoresizingMaskIntoConstraints = false view....
Miaperolla's user avatar
0 votes
1 answer
62 views

How to animate geometry using the primitiveRange property in SceneKit?

I am using Apple's SceneKit to render a tube which consists of 50 triangle strips as illustrated here: I want to animate a "growing" tube by using the primitiveRange property. let tube = ...
wcochran's user avatar
  • 10.1k
0 votes
1 answer
79 views

How to animate a Path without creating a SubView in SwiftUI

Is it possible to animate a Path without creating a SubView? Eg. struct ContentView: View { @State private var end = 0.0 var body: some View { VStack { Button(&...
rayaantaneja's user avatar
  • 1,212
0 votes
0 answers
45 views

Resuming circle progress bar animation after pausing it [duplicate]

I'm trying to create an application that uses a timer. And in addition to the timer I want to use a circular progress bar. The code is below. It's simple but looks good. But then I need it to pause ...
0 votes
1 answer
55 views

Animate image crop from right to left

I want to animate a change in the width of an ImageView in Swift, in a way it will be appeared as if the image is being cropped from right to left. I mean that I want the image to always stick to the ...
Miko65's user avatar
  • 1
1 vote
0 answers
82 views

Animate several properties of several views with Core Animation

I want to animate several properties of several subviews using Core Animations in Swift. I'm looking for a way to group the animations together and handle them as one, mainly to be able to synchronise ...
MiZioLi5's user avatar
0 votes
1 answer
111 views

Animate image scale change while preserving its width and height

I want to animate zooming-in and out from image in Swift using CAAnimation while preserving the original width and height of the image (i.e. show smaller area in the image enlarged). I tried to use ...
Ali AD's user avatar
  • 13
-1 votes
1 answer
113 views

Metal Sampler ::linear doesn't work as expected

My source image is a 512x512 pixels checkerboard (see source image). When I render it to 1/3 of its size (170,6.. x 170,6..) the result looks like it is downsized with the ::nearest filter. I expect ...
Jared's user avatar
  • 130
0 votes
0 answers
35 views

Create flip cart animation between two NSViews [duplicate]

Hi I want to create flip card animation between two full screen NSViews but my animation didn't work as expected like in iOS here is example of iOS working code UIView.transition(from:self.upperView, ...
Jozef Porenut's user avatar
-1 votes
1 answer
40 views

isRemoveOnCompletion not work after the animation is completed

I want my moonImageView to keep its last size/dimension after the animation ended; image gets bigger by 1.25 time, but adding isRemoveOnCompletion = false did not help. The size of image returned back ...
Steven-Carrot's user avatar
0 votes
0 answers
84 views

Exporting Core Animations to Videos

I have been trying to get AVAssetExportSession to save a video with animations overlaid, but am running into a problem where the exported video has a runtime of 0:00. As I understand it, the ...
Professor Tweetzer's user avatar
1 vote
1 answer
64 views

How can i know when default functions animations finish?

In my application, i listed delivered notifications as sorted by date in tableView. If user tap to notifications from device notification screen, app highlights row. But before user presses ...
Vileriu's user avatar
  • 25
0 votes
0 answers
63 views

How do you apply a CIFilter to only one videoLayer in AVVideoCompositionCoreAnimationTool?

I have two videos, one overlays another, and I want to blur the one in the background. I have two layers: let parentlayer = CALayer() let videoLayer = CALayer() Two things don't work: if let ...
Матвей Марюха's user avatar
0 votes
0 answers
151 views

Replace CATransition animation with UIView animation

Could anyone guide me how I can perform the following CATransition animation: let animation = CATransition() animation.duration = 0.25 animation.type = CATransitionType.push ...
Tywin's user avatar
  • 21
0 votes
1 answer
95 views

UIView animation snaps into updated bounds before animation is done

Problem: I am trying to create my own custom search field with a desired growing animation (if you click on it), and a shrinking animation when the user taps out. The animation behaves weirdly since ...
linus_hologram's user avatar
0 votes
1 answer
64 views

Adopt CAGradientLayer frame to UIView bounds during animation

In my UIViewController I have a UIView with added CAGradientLayer. I also have a height constraint for the view, that I change inside UIView.animate closure. What I need is the gradientLayer also to ...
Alex Sh.'s user avatar
  • 589
-1 votes
1 answer
150 views

How To Change Contents Of A CAEmitterCell In A CAEmitterLayer Particle Emitter

Background I have a function that creates a core animation emitter layer that animates myImage1, in the code below. I want to change myImage1 to myImage2 to myImage3 and back to myImage1 after a delay ...
user4806509's user avatar
  • 2,953
2 votes
0 answers
239 views

AVMutableVideoComposition messes up colors (wrong color space?)

I'm creating an AVURLAsset from a video file, then use AVMutableComposition, AVVideoComposition, and AVVideoCompositionCoreAnimationTool to render three CALayers: host layer, video layer, and a shape ...
tin's user avatar
  • 31
0 votes
1 answer
103 views

CARenderer draws nothing into bound texture

I'm trying to setup a CARenderer to draw into a mtlTexture, but all my attempts to get this working in a playground don't draw anything. The resulting image is solid red, the yellow layer doesn't seem ...
Mike Woodworth's user avatar
0 votes
1 answer
113 views

How to Use an AnimatableVector for Simple 2D Plotting

My Swift macOS app renders a simple 2D plot of a one-dimensional array (representing an audio spectrum) provided every 100 milliseconds. The resultant visualization at 10 frames per second appears ...
KeithB's user avatar
  • 427
2 votes
1 answer
97 views

merge two CAShaplayer with transparent in Swift5?

We have created two CAShapeLayer and we have animated them by CABasicAnimation changing position like fromValue to toValue so far code works as excepted. Two layers meeting at some points while ...
karthikeyan's user avatar
  • 3,831
-1 votes
1 answer
184 views

Cloud moving animation in Swift? Is it possible?

We are following this tutorial to http://www.invasivecode.com/weblog/core-animation-scroll-layer-cascrolllayer As per their tutorial animation will stop based on the layer bounds reached. How to do ...
karthikeyan's user avatar
  • 3,831
0 votes
1 answer
96 views

How to Animate UIView on a line path without using UIBezierPath?

I have draw UIView say rectangle(player) and line, using context using draw(_ rect: CGRect) method. I want to move the player on a line when clicking the play button. I have searched lots of, but I ...
Pinal's user avatar
  • 23
1 vote
1 answer
326 views

How do I disable Core Animation compositor in my Metal iOS (iPadOS) App

I have 3 questions relating to something from Apple WWDC 2015, more precisely Session 610, "Metal performance optimisation techniques", slide 125 (or minute 33:56 in the video), to be found ...
Céline's user avatar
  • 205
0 votes
1 answer
243 views

Fill the CALayer with different color when timer reaches to 5 seconds swift ios

In my app i am using a third party library which does circular animation just like in the appstore app download animation. i am using the external file which i have placed in my project. it works but ...
nishant narola's user avatar
0 votes
1 answer
113 views

Prevent `CALayer` from dropping shadow set by its parent layer

Recently I've been playing around with shadows and one particular case got me really interested. Suppose I have a parent CALayer which has three oval-shaped sublayers laid in a stack. I applied shadow ...
Alexandr Chekel's user avatar
0 votes
1 answer
252 views

How exactly do I have to use the perspective transform on CALayer?

I'm attempting to add perspective to a view in UIKit. Currently my implementation looks like this: let view: UIView ... vat perspective = CATransform3DIdentity view.layer.sublayerTransform = ...
sak's user avatar
  • 2,662
1 vote
0 answers
440 views

What's the easiest way to do vector/matrix math in iOS?

I want to do some simple linear algebra in an iOS app. I need to multiply a couple 4x4 matrices, and then multiply it with a vec4. I see there is CATransform3D which appears to implement some basic ...
sak's user avatar
  • 2,662
0 votes
1 answer
195 views

CABasic strokeEnd Animation is not working with customView in swift?

on calling startAnimation() the stroke Animation is not showing up, however, on using UIView.animate inside startAnimation function, it is working fine, only CABasicAnimation is not working. I am not ...
H1rouge's user avatar
  • 61
0 votes
1 answer
78 views

How should I make rounded NSBox with blurred background?

Is there a way that I can make a transparent and rounded NSBox with a blurred background? I have tried to use CA Background Filters to achieve this, but it seems that the part of the background which ...
Impossible Reality's user avatar
0 votes
0 answers
130 views

How can I animate only the text which is added to a label?

I've achieved the functionality of changing text on a UILabel and applying styling to particular characters in a subset of a string used for that attributed text, for example on a string $0.00, I can ...
user avatar
0 votes
1 answer
767 views

ios animation - display image/fill color from left to right with animating

I have a image, been added to CALayer.contents. The image basically contains a word/letters, the requirement is to animate like showing up letters from left to right gradually, mean while animating ...
fullstackdev's user avatar
1 vote
1 answer
85 views

Create a flare effect using CoreAnimation

I was wondering is possible to create something like this flare animation with UIKit and most likely with Core Animation? The only thing similar to this i've used previously was CAEmitterLayer and ...
Maysam's user avatar
  • 7,246
0 votes
1 answer
36 views

Swift SceneKit animation of several points

I have an array of values which is a mesh angles, e.q. let meshAngles = [[0,0,30], [0,0,70], [0,0,90]] now I want to animate this angles with mesh in loop: for val in meshAngles{ rotateMesh(...
Alek Szczęsnowicz's user avatar

1
2 3 4 5
83