Can you animate gradients with quartz on the iPhone?

I am new to iPhone development and am currently developing a graphical tool developed for Silverlight.

I am currently using a gradient to “fill in” a rectangle representing a panel inside a chart. Is it possible to animate this gradient so that it changes color when the user touches the panel in the chart.

I have looked at Apple's Core Animation tutorials, but I don’t see a property that targets gradients. I suppose I could use the fade transition between two rectangles, one of which has my initial gradient, and the second with the “affected” version, but that would obviously mean drawing a few rectangle objects for each bar, and I suggest additional official overhead.

Any ideas?

+3
source share
1 answer

Yes, you can animate gradients using Core Animation.

The CAGradientLayer class, released in version 3.0, has a good API for rendering gradients in a layer and animating color and color changes.

, , .

, CABasicAnimation, , . , .

, - , , .

+11

Source: https://habr.com/ru/post/1724278/


All Articles