Questions tagged [calayer]
CALayer is a Core Animation class in the Quartz Core framework. It encapsulates the geometry and presentation of a layer. It supports animations of the layer's geometry and its content.
2,839
questions
0
votes
2
answers
56
views
How to fade out end of last line in multiline label?
Note, that it must work with different number of lines in UILabel - 1,2,3 etc.
I've already found solution for 1 line label, where you mask UILabel's layer with CAGradientLayer, but it doesn't work ...
0
votes
1
answer
28
views
How to draw same size dotted line on UIView
Can someone please guide how I can draw same size dotted line on UIView for all sides?
I am using below code to draw line.
let dashBorder = CAShapeLayer()
let frameSize = self.frame.size
let shapeRect ...
0
votes
1
answer
64
views
in layer based drawing how can we reduce the lag while drawing or zooming UIView?
I'm working on a drawing app where every bezier path is CAShapelayer and I'm adding these sub-layers on super layer UIView(CALayer), once the points/lines exceed a certain threshold eg: 1000 ...
0
votes
0
answers
24
views
Uitextfieldwith dashed line, focus, default dashed color lines in swift
I haven given spaces between chars with NSattributes.kern, need to change focus color of next char border when text enter, should be do with one textfield
class customTextFiled : UITextField {
for ...
0
votes
2
answers
79
views
CAShapeLayer Image Not Appearing
I have an image.cgImage that I set as the contents to a CAShapeLayer() but it's not appearing. I force unwrap the image so I know that it definitely exists. The round shape appears but the image ...
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
2
answers
78
views
Using a CATextLayer to Mask Out From Another CALayer
For whatever reason, I can't get this to work with a CATextLayer. I suspect it's totally obvious, and I can't see the forest for the trees, but what I need to do, is use a CATextLayer to mask a "...
0
votes
1
answer
103
views
How to render UIView into an image at higher resolution?
I'm trying to create image-snapshot tests for UIView. Unfortunately for me my CI machines have @1x pixel-to-point ratio, and my local machine has @2x, so basically I'm trying to render a UIView on @1x ...
0
votes
1
answer
121
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
0
answers
24
views
Is it possible to record video and overlay with CALayer simultaneously using AVVideoCompositionCoreAnimationTool?
I'm currently working on app that records video of user, binds particle emitters to hands landmarks on preview. In result effects are shown on camera preview, but they aren't captured on video.
I saw ...
0
votes
1
answer
45
views
changing size of CALayer also changes size of previously added layer's size
i'm trying to draw over UIImageView with this custome class and i would like to be able to change the size and color of lines being drawn by user. But every time i change the size or color of CALayer ...
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
43
views
How to make custom ripples like Square, Stare and other custom shapes in Swift 5?
I have facing issue to make ripples in Square and Stare figure like YRipple
Please help me and suggestion always welcome.
0
votes
1
answer
18
views
How to make UINavigationBar shadowImage fixed?
I have a reversed UITableView:
tableView.transform = CGAffineTransform(rotationAngle: -(CGFloat)(Double.pi))
NavigationBar setup:
navigationBar.shadowImage = UIImage()
navigationBar.layer....
0
votes
0
answers
53
views
What exactly is error "CALayer: ignoring bogus Layer Size"?
I am getting this error when one of the subview in UIScrollView is "too large". I use drawRect to draw this subview. Nothing is drawn when this warning appears as setNeedsDisplay() calls are ...
0
votes
2
answers
130
views
When use cornerRadius, iOS UIView background color is wrong color
I apply cornerRadius for UIView, and apply the border color.
But, I can see the wrong color at the corner.
This image below is an enlarged image for simulator.
And this image below is debug view ...
0
votes
0
answers
47
views
IOS App UIView not resizing on different devices
would appreciate some advice. I have an app with a UIView, which contains a CALayer with animation.
Using constraints, I resize the UIView for Ipad with a bigger width and height. I noticed in ...
0
votes
0
answers
23
views
Recreate zoom gesture on CALayer with CABasicAnimation
While watching a video, a user is able to zoom in on that video and scroll around to a range of offsets. What I would like to do is recreate that exact zoom/pan gesture on where they last left off and ...
-1
votes
2
answers
62
views
Covering a CALayer with a CGImage
I have a CGImage that I want to show in a CALayer. Setting the content and the gravity to the bottom-left works like expected.
layer.contents = cgimage
layer.contentsGravity = .bottomLeft
Now I want ...
1
vote
0
answers
39
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 ...
1
vote
1
answer
53
views
Multiple CAShapeLayers with .round lineCap are overlapped by each other
I try to combine multiple layers using .round lineCap and a semicircle path:
let layer = CAShapeLayer()
layer.lineWidth = 12
layer.lineCap = .round
layer.strokeColor = color.withAlphaComponent(0.32)....
1
vote
1
answer
235
views
UIView with background color looks different than CALayer with background color. Why, and how to make them match?
I created a little project (Github link) demonstrating how to add a line under a UITextField to answer this SO question.
The OP was trying to add the underline using a CALayer, so that is how I ...
0
votes
1
answer
50
views
Applying more than two CIFilter over the CALayer
I am trying to make Canvas with CIFilter's for UIImageView. In my application user should have opportunity retouch his photo using UIPanGesture (Adding UIBezierPath to CALayer).
But I've faced with a ...
0
votes
0
answers
42
views
AssetReader/AssetWriter - CMSampleBuffer and CALayer
I'm transcoding a video to embed the drawings of ML Vision onto the new video. The approach is to use the avassetreader and avassetwriter. I pass cmsamplebuffer to the vision and get the results. I ...
0
votes
2
answers
68
views
Convert CAShapelayers to SVG [closed]
Is there any way to convert a CAShapeLayer to a SVG image and export it in Swift?
1
vote
0
answers
61
views
How to rotate a view using angle and bounds size of a rotated layer in macOS using Swift?
I have CALayer that I rotate using Pan Gesture and CGAffineTransform. Here is how the CALayer rotates:
containerView.layer?.addSublayer(caLayer!)
/// Apply rotation
let angleInRadians : CGFloat = ...
-1
votes
1
answer
35
views
iOS - CALayer protruding bounds on orientation change
I have a simple CustomView. I have a CAGradientLayer that I am adding to the layer.
@IBDesignable
class CustomView: UIView {
override init (frame: CGRect) {
super.init(frame: frame)
...
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
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 ...
1
vote
1
answer
179
views
Add Shadow to CAShapeLayer with UIBezierPath
need some help adding a drop shadow to a line created with a CAShapeLayer / UIBezierPath
This code snippet produces the following line shape as in the screenshot below
let bounds = UIScreen....
-2
votes
1
answer
134
views
Animate a CALayer frame change
I'm trying to create a Custom Progress Bar View and the idea is to have a timer that will update every second. However, the transition from the progress is not so smooth.
If I reduce the timer ...
1
vote
2
answers
104
views
Smooth animation CAGradientLayer with long duration
Created CAGradientLayer with a sharp color transition. Position of the color transition changes during the time with using CABasicAnimation.
Everything works, but if I use long duration, animation ...
2
votes
1
answer
275
views
Swift how to mask shape layer to blur layer
I was making a progress circle, and I want its track path to have a blur effect, is there any way to achieve that?
This is what the original track looks like(the track path is transparent, I want it ...
0
votes
0
answers
85
views
CALayer custom property animations and presentation layer lifespan
I’m trying to create animatable custom properties in subclasses of CALayer. I’ve found a few references on the web for this, but some are still in Objective C. Here is an experimental layer in Swift ...
0
votes
1
answer
48
views
The background mask cuts off part of the foreground layer
Recently ran into a problem in one of my tasks. I tried to solve this problem for two days. Finally I came here.
I have a custom progress view. Don't look at the colors, they are so awful just for the ...
0
votes
0
answers
36
views
Draw animated rounded rect line with gradient color
So I'm trying to create a loading indicator on an element, basically it's a path that's expanding and contracting towards the end.
The hard part is that the path is a gradient color which I have no ...
1
vote
0
answers
39
views
How do I set a border or background image for an individual cell in NSGridView?
I see where I can apply a background image to the entire backing layer of a NSGridView. However, what I want to do is to apply a NSBox or NSColor to the background of a single NSGridCell object so ...
0
votes
1
answer
213
views
UITableViewCell shadows overlay
I have a table view with cells.
Overlaying shadows is done, but that looks not like I wanted.
My shadow white round rectangles should stay white. And shadows should overlay below white rectangles. Any ...
0
votes
1
answer
63
views
UIProgressView doesn't restart if the animation hasn't finished
I'm doing a workout app and I have a UIProgressView that gets filled with animation while the exercice is happening. At the end of it, it gets restarted to 0 and filled again with the next exercice of ...
0
votes
2
answers
198
views
iOS - Draw a view with gradient background
I have attached a rough sketch. The lines are deformed as the sketch was drawn manually just to illustrate the concept.
As seen in the sketch, I have a list of points that has to be drawn on the view ...
1
vote
1
answer
1k
views
iOS skeleton loading animation
I am working on adding skeleton loading to an iOS app. I have a UICollectionView where each cell should display a "loading" state while data is being loaded. To handle this state, a skeleton ...
1
vote
1
answer
154
views
Can you use a grayscale image with no alpha as a layer mask?
Normally if you install an image as the contents of a layer's mask layer, the alpha channel of the mask layer's image is what masks the other layer. I know how to do that.
I have a vague memory of ...
0
votes
1
answer
120
views
iOS UICollectionViewCell resizable dashed border
I have a UICollectionView where some of the cells should have a dashed border and some of them should have a solid border. Also, the cells can be of varying size depending on the content that is ...
1
vote
2
answers
351
views
Using custom CIFilter on CALayer shows no change to CALayer
We are trying to create a custom CIFilter to add on top of our CALayer's. How ever only the default CIFilters seem to work on a CALayer.
We created a small new project on the ViewController.swift we ...
0
votes
0
answers
45
views
Adding mask to CALayer which contain UIImage and then save them as a video takes too much time
I used code from here ( https://stackoverflow.com/a/46560615/13671576 ) to create and save animated video from UIImages. When I used mask to CALayer, it takes too much time to save the video.
118 ...
1
vote
1
answer
150
views
Make a see-through layer
I am trying to implement erase functionality on my app. For image I can do it with setting bend mode into clear while drawing image with UIGraphicsBeginImageContextWithOptions. Here is the code I have ...
0
votes
1
answer
177
views
How to update UISlider's value automatically when core animation is playing without Timer
I've created core animation using 40 images (Per image stays in CALayer exactly 3 seconds).
Total duration = 120 seconds. Each photo move from left to right with the help of CABasicAnimation(keypath :...
1
vote
2
answers
239
views
why isnt my CaLayer showing up on top of the UIView?
I want to display a view on a UIViewController using the UIView called LoadingView. However, whenever I try to use the following code, only the UIView appears without the CALayer.
Ideally, this code ...