Flutter: How Can I do This circle transform animation like this photo - flutter-animation

An Image from app Sebha, I have a task liker this How I can do this Animation

Related

Transformation based on Hero animation progress

I want to transform a Flutter widget based on the progress of a Hero animation.
For example, I'd like to gradually clip an image while moving it to another page (using a Hero animation). In case of using a regular animation, I would just call the .value attribute in order to check the progress of the animation and transform the clipper according to that value, but how can I achieve something similar with a Hero animation?
You don't have to listen to the progress of your hero animation to achieve what you are trying to do.
Child of Hero widgets do not have to be the exact same. You can clip one of the widgets, and leave the other one unclipped. The Hero widget will automatically animate the widget from being unclipped to clipped.

Animation Corresponding to UITimer

I am coding a game in Swift where the player has to make a move within a second, or else time runs out and he/she loses. How can I make an animation that runs every second, resembling the one in the top of Snapchat stories, where it is a filled in circle that slowly "wipes" away in a circular motion like a windshield wiper? Is it just a second-long GIF that I loop every second? Is there a way to do this with native UIKit graphics?
I think what you are looking for is a "clock wipe" animation. You can do that by adding a mask layer to your image and animating it using Core Animation.
I wrote a SO post on this very subject:
How do you achieve a "clock wipe"/ radial wipe effect in iOS?

Calling drawRect to draw on top of CALayer?

I current have a view with its CALayer as an AVCapturePreviewLayer, to output video from the iphone's camera. I would like to call drawRect and draw on top of this video output, like draw a simple line on the screen with the current camera capture in the background. The problem is that everything in drawRect appears behind the AVCapturePreviewLayer instead of in front of it. Is there a way to implement this functionality? Preferably without using multiple views?
Add a sublayer to the view's layer:
[view.layer addSublayer:...];
Then draw what you want on the sublayer.

GPUImage background subtraction iOS

I start capturing the camera with startCameraCapture and using setFrameProcessingCompletionBlock for take a GPUImageOutput (my background image).
Now I want for each frame to subtract my background image from the other captured frames.
How I can achieve this?
Thanks

Using panning gesture to animate GCRect resize

I'm drawing a few circles, each filled with an image. When the user pans I'd like to scale/resize the circles. So I called drawRect again and again, redrawing every GCRect until the gesture was completed - of course the animation was very choppy. In my case a UIScrollView doesn't fit the needs, because I don't want to scroll, but to scale the circles while the user is panning.
Is there any way except using OpenGL ES to implement this functionality?
Do you really need custom drawing for this? You can easily clip an image to a circle without drawRect.
Without -drawRect:
Using Core Animation you can set the corner radius of a layer. If all you want is to show an image inside a circle then you can put the image in an image view with a square frame and set the corner radius of the image views layer to half the width of the frame.
Now each time the user drags you can change the bounds and the corner radius of the image views layer. This will make it look like the circle becomes bigger/smaller.
If you require custom drawing
Maybe you are doing some custom shadows or blending that can only be done with Core Graphics. If so, you could apply a scale transform and stretch the image while the user is dragging their finger and only redraw once the finger lifts from the screen. That will be much, much cheaper and is also very easy to implement. Just create a scale transform (CGAffineTransformMakeScale(xScale, yScale);) and set it as the transform on the view with the circle (this will only work if each circle is its own view).
Note: You can still use the same trick (scaling while dragging and then redrawing) if you use the corner radius approach if you require the extra performance.

Resources