1

I was wondering if it was possible to change the color of a UIBezierPath strokeColor while its animating. For instance, if it goes past a certain angle like 45 deg, it changes from green to orange, and if it goes past 66 deg it goes from orange to red.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Faisal Syed
  • 921
  • 1
  • 11
  • 25

1 Answers1

0

Somebody else suggested using a "gradual" (gradient) layer. If you can create a gradient that meets your needs then that would work.

You could do just about anything you want by creating an image that contains the colors you want, and then installing a shape layer as a mask layer to that image's layer, and animating changes to the path installed in the shape layer.

I've used a technique like that to create various sorts of "wipe" transitions that reveal an image. See the thread below for info and working code showing how to create a "Clock wipe", which is almost exactly what you need:

How do you achieve a "clock wipe"/ radial wipe effect in iOS?

Community
  • 1
  • 1
Duncan C
  • 128,072
  • 22
  • 173
  • 272