How to create a complex SVG layer fill animation based on CAShapeLayer - ios

As you can understand from the title of this question I am trying to achieve fill animation of CALayer(CAShapeLayer) of SVG file.
How complex should be animation you can see from the images I attached.
I decided to start just with a circle and animate it to fill a layer below. Everything works pretty well.
So, I started building UIBezierPath or something like that but it looks like I am going the wrong direction.
I would really appreciate if you can just give me different ideas how to achieve it.
For SVG I use SVGKit. Maybe by using these set of classes, I can do something.
Thank you!

Related

Firemonkey: How to draw just a point on a canvas

I m just a little surprised but It looks like on firemonkey there is no easy way to draw a single point on a Canvas? or I m tired and I miss something?
As many ask me, below a sample of what I want to achieve (I want to also make a dynamique animation and move each dots on the fly)

How to use globalCompositeOperation in Konva for multiple shapes with scaling

I'm trying to create polygons with an inner border in Konva.
I found this example of doing this with globalCompositeOperation which works well in Konva, as long as there is only one shape. As soon as I try to add a second shape, this obviously doesn't work anymore and the first shape disappears.
It would work if I were to use a different layer for every shape, but of course that's not a solution that scales well.
I tried using a temporary layer as is done in the example but couldn't get it to work.
So I found this example of using group.cache(), which works fine ... until I try to scale the stage, at which point I would have to refresh the cache, otherwise I only get the scaled up cache, which looks bad.
This codesandbox illustrates the problem. (Please note that this uses simple triangles, in reality I work with arbitray polygons)
So is there a way to use cache with scaling? Or alternatively a better way to use globalCompositeOperation with multiple shapes in the same layer? Or some alternative solution?
I found a solution: calling group.cache({pixelRatio: scaleFactor}). I updated the sandbox.
No idea, if this is the best solution, but it works.

The best way to create animation diagram

I'm trying to create something like this:
I looked many resources for that, but I still don't have idea how can I do it. Using CoreAnimation, Quartz2d or UIBezierPath I can draw a circle, but how can I draw a nice diagram with touch gesture's aid, using that? Maybe I wrong searched? If any tutorial, or sample code for this issue?
Best and easy library I used to draw pie chart with animation; MIM Chart Library for iOS
https://github.com/ReetuRaj/MIMChart-Library
Open source.
OK, CoreAnimation is not what you're looking for with this.
Anyway...
If you want to make a nice Pie Chart then you should take a look at CorePlot.
It has a lot of graphing functions and pie charts are in there too.
You can still animate with this you just need to update the percentages based on touch. Don't try to animate the sections of the circle. Change the percentages and update the circle.
Looks like you are trying to do some charts & plotting. If that is so, there is something called as
Core Plot
ILGraphics
OVGraphView
Some controls as well
Hope that helps.

Simple iOS particle emitter

Is there a simple way to do a bunch of 2d particle images using core animation like the star particle animation in Draw Something?
Particle animation in Draw Something
I found this link which get's me 90% of the way there. It shows how to emit particles using UIImage which is just what I need. I just need some help tweaking the particles so they spew out like the Draw Something button and not like their fire example and I want to randomize the colors of the particles and make them glow.
http://www.raywenderlich.com/6063/uikit-particle-systems-in-ios-5-tutorial
Okay, just found this which got me the rest of the controls I wanted. The variable I was looking for on the emitters was yAccelleration. Set it to a positive number to make it go down.
http://developer.apple.com/library/mac/#samplecode/Fireworks/Listings/AppController_m.html
Hope this helps someone else!

UIView transform

I got an UIView with 4 views in the corners which will be dragged to create a perspective effect. This is how it looks like in the beggining:
Once the user drags a view, it will create a transform effect. For example:
I investigated it and I figured out I have to use CALayer to do that, but I'm still no clearer on how to create this kind of transform on an iPhone. Any help, pointers or example code snippets would be really appreciated!
Thanks!
You should search for CATransform3D. But this is kind of a good start.

Resources