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
4,129
questions
0
votes
1
answer
17
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 = ...
-1
votes
0
answers
23
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 ...
-1
votes
0
answers
28
views
Is it possible to animate on a custom variable on a custom view?
Let's say I have a custom view that draws based on a continuous variable
class MyView: UIView {
var myVar: CGFloat = 0
override func draw(_ rect: CGRect) {
guard let context = ...
0
votes
0
answers
8
views
TableviewCell Animation on scrolling Swift
Please help with the similar animation as below for tableviewcell scrolling
TableViewCellScrollingAnimation
0
votes
0
answers
22
views
Number or hardware draw calls in Core Animation
I’m building a Metal app which renders a few objects to a view, similar to how Core Animation renders its CALayers. Soon I realized that rendering each layer with a separate draw call can be expensive ...
0
votes
1
answer
28
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 ...
0
votes
1
answer
32
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 ...
0
votes
0
answers
33
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 ...
0
votes
0
answers
26
views
Adding confetti animation behind the human/Animal body to a Video
I want to add confetti animation to a video so that when any animal/human appears then confetti animation should be running behind the human/animal's body. I used following code but here confetti is ...
0
votes
0
answers
17
views
ReplicationLayer stopping animation once the first instance finishes animating, but the other instance animations are cut short
I have attached a gif of what the animation looks like when setup as described below. How can I ensure that all 6 instances of the replicatorLayer finish animating and then remove the leftover coin ...
0
votes
1
answer
133
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 ...
0
votes
1
answer
13
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 ...
0
votes
1
answer
20
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(...
0
votes
1
answer
102
views
When exactly is drawInMTKView called?
MetalKit calls drawInMTKView when it wants a your delegate to draw a new frame, but I wonder if it waits for the last drawable to have been presented before it asks your delegate to draw on a new one?
...
0
votes
1
answer
60
views
CATiledLayer in NSView flashes on changing contentsScale
I have a CATiledLayer inside a NSView which is a documentView property of NSScrollView.
Storyboard setup is pretty straitforward: add NSScrollView to the default view controller and assign View class ...
0
votes
1
answer
76
views
Halve scroll speed for UIScrollView?
For testing (and for screen captures) I use layer.speed to slow down animations globally.
window.layer.speed = 0.5
Yet this only controls animations, I cannot control UIScrollView speeds. Is there ...
0
votes
0
answers
25
views
CAKeyframeAnimation rotation direction issue for "transform.rotation.x"
I'm trying to make a 3D card flip animation.
When i change values for different keyPath rotating direction changes as expected but i can't change the rotation direction for transform.rotation.x
I ...
1
vote
0
answers
40
views
How to draw CALayers during an animation so that they appear correctly?
Inside a LazyHStack, I use UIViewRepresentable to draw an avatar for each item.
The avatar is drawn using CALayers:
override public func draw(_ layer: CALayer, in ctx: CGContext) { draw(layer) }
...
0
votes
1
answer
19
views
Deprecated animation missing expression
I know there is a similar question to this but I am not seeing what I am doing wrong when I compare my code to the other similar questions so can someone please help me understand what I am missing? I ...
0
votes
0
answers
12
views
beginAnimations:context: deprecated [duplicate]
How do I update my code so that it is no longer deprecated for setAnimationDuration: and beginAnimations:?
if (animated) {
[UIView beginAnimations:nil context:NULL];
[UIView ...
0
votes
1
answer
21
views
Animation not happening as it is supposed to be for subclass of UIView with layers
I am trying to animate a subclass of UIView that has a some layers with shadow. In a view controller, I set this view inside a container. I animate container's height constraint. The container (the ...
0
votes
0
answers
34
views
How to detect UI updates in ios, similar to android's ondrawlistener()?
When monitoring the fluency of the page, for the same page, it is hoped that the frame rate (CADisplayLink) collection will be performed when the page changes, and when the page is static, that is, no ...
0
votes
1
answer
31
views
How to animate sublayer contents?
I have a layer and want to create an animation for this layer which will update contents of one of sublayers. CAAnimation keyPath has a notation, like sublayers.layerName.propertyName to update some ...
1
vote
0
answers
40
views
Zoom into AVCaptureVideoPreviewLayer
I am setting up a AVCaptureVideoPreviewLayer which shows the full video input in the preview just fine. Now I want zoom into (the layer). I tried to scale and transform on the CALayer level. This does ...
0
votes
0
answers
126
views
Convert UIImage to SVG file
I have UIImageView (which contains CAShapeLayer or GradientLayer). I want to convert it in SVG file and save on Document Directory for future usage. I searched a lot on internet but in vain.
I found a ...
0
votes
1
answer
27
views
WRONG LINE LENGHT shapeLayer.strokeEnd = 0.5 draws more than half of the circle [duplicate]
I want the line to end at the top with shapeLayer.strokeEnd = 1.0 and get a circle. the line must end here
but she goes on, it just can't be seen
full circle
when i specify a value of 0.5 i want to ...
2
votes
1
answer
112
views
Safe area is not updated after UIViewController.viewWillDisappear is called
To me it looks like the safe area of a view is not updated after the owning view controller's .viewWillDisappear() method is called.
Is this intended or a bug in the framework?
The issue is easily ...
0
votes
1
answer
53
views
CoreAnimation CATransform3DScale hides a UIView
I am trying to make a view have the effect of popping out of the screen. However, each time I try to use CATransform3DScale, the view disappears. I have tried adjusting with the zPosition, but that ...
0
votes
1
answer
95
views
How to make CGWindowListCreateImage render correct background color?
Capturing an image of an off-screen window with CGWindowListCreateImage is a common way to create QuickLook style zoom-in animations, but this seems create an image with the wrong background colour, ...
0
votes
1
answer
69
views
Interrupt and reverse CAKeyframeAnimation
I have a checkbox view that can be checked or unchecked. I would like to animate the drawing of the checkmark and to do so, I am using a CAKeyframeAnimation and drawing on a CAShapeLayer.
This works ...
1
vote
0
answers
53
views
SwiftUI spring timing doesn't appear to match UIKit spring timing
With identical parameters, the SwiftUI spring timing function doesn't appear to match the UIKit spring timing function (specifically, UIViewPropertyAnimator).
In the video below, we have two labels, ...
0
votes
4
answers
179
views
Draw rectangle around CAShape Layer
I am new in Swift and also in Core Animation. I want to create rectangle box around CAShapeLayer just like in this image, but I don't know.
In detail, I am parsing SVG image through PocketSVG and ...
1
vote
1
answer
323
views
How to fix missing fade animation CATransition in ios15?
I have a bottom-up push animation of text. In iOS 14 and earlier, it worked with fade animation. Starting with iOS 15, the behavior has changed: the implicit fade disappeared. Any ideas on how to get ...
0
votes
1
answer
146
views
UIViewPropertyAnimator state inside completion block?
Playing around with UIViewPropertyAnimator, I am stuck in a weird problem.
Here,
let animator = UIViewPropertyAnimator(duration: 1, curve: .linear)
animator.addAnimations(someAnimationBlock)
...
2
votes
0
answers
69
views
AVVideoCompositionCoreAnimationTool is not animating custom properties during export with AVAssetExportSession
I'm trying to add an animated CALayer over my video and export it with AVAssetExportSession.
I'm animating the layer using CABasicAnimation set to my custom property.
However, it seems that func draw(...
0
votes
0
answers
37
views
start css effect from x px / x% width count from left to y px / y % count from right
How can I apply my css from width of 80% to width of 60% count from right? I would like to have reveal text effect in css that I set up but it start from 0px count from left to 1500px to right. How ...
1
vote
2
answers
158
views
Creating inner shadows in UIView to replicate Neumorphic Style
I have the task to implement neumorphic design styles in my UIKit application. I have successfully implemented the double outer shadows (dark and light), but I somehow, can't figure out how to ...
0
votes
2
answers
107
views
How to fit CAShape Layer to UIImage View?
I am parsing SVG image file and convert it paths into CAShapeLayer, after that I am adding this CAShapeLayer to UIImage View's layer.
It's work fine, but the problem is that it does not fit to the ...
1
vote
1
answer
53
views
Change UIView display order globally within view hierarchy
Consider the following view hierarchy:
let bottomView = UIView()
addSubview(bottomView)
let bottomViewSubview = UIView()
bottomView.addSubview(bottomViewSubview)
let topView = UIView()
addSubview(...
1
vote
0
answers
25
views
AVSynchronizedLayer does not play animations on macOS
I can't make animations to work with AVSynchronizedLayer on macOS. When the player is playing, nothing is animated in the AVSynchronizedLayer.
Interestingly, when I use almost identical code on iOS, ...
0
votes
1
answer
55
views
How do I set an endpoint for a CAKeyFrameAnimation?
I am using an arc for a progress bar.
There is a track layer that the progress indicator moves along and I also have a circle that moves with the progress bar for added emphasis. Both the progress ...
0
votes
1
answer
106
views
How to animate the appearing of a CALayer using CATransaction?
I want to animate a CALAyer so that it looks like it appears out of nowhere. I thought I could first set the transform of the layer to "scale to x: 0, y: 0". Then do an animation to set the ...
0
votes
0
answers
45
views
Tap on UIView while it is animating
I have 4 UIViews(which act as a parent view for ImageView) as options of a question. I animate each option to move left to right and repeat and user has to tap on each option to see whether they have ...
0
votes
0
answers
16
views
Relationship between UIBezierPath point coordinate system and the layer's
I am really confused by UIBezierPath's point system and its corresponding function such as moveToPoint.
Which coordinate system does the point belong to? It doesn't even have a layer until we assign ...
0
votes
0
answers
27
views
CATransaction duration doesn't work when changing background color
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 10
}
func animateTransition(using transitionContext: ...
2
votes
0
answers
53
views
How to do smart animations in android studio
Today I am using Security scanning app in xiaomi phone on that app while I clicking button it will open animation screen and scanning process. My question is how is that possible embed animation in ...
1
vote
0
answers
71
views
How to achieve this animation with multiple CAShapeLayer
I'm having a lot of trouble exporting a video with animated layers.
The final goal is to export to a video (that's why I need this done with CALayers) a moving CAShapeLayer around the screen and a ...
0
votes
0
answers
40
views
Is it possible to collect CAEmitterCell objects at the bottom of screen?
CAEmitterLayer and CAEmitterCell is a great way to create animations like snowflakes or raindrops but is it possible to collect them at the bottom of the screen so they dont disappear but stay on a ...
1
vote
1
answer
43
views
Synchronizing CALayer drawing
A drawing application has multiple CALayers. One CALayer displays drawing objects, which are expensive to draw. An overlaid second CALayer displays hover effects - the drawing objects are highlighted ...