I want to have a smooth color transition that goes across the entire spectrum (i.e. red, blue, green, yellow, orange, etc.)
Also want to be able to have smooth transitions of colors in specific spectrum (i.e. all reds).
Are there any simple algorithms/recursive functions/formulas that can help simplify this process?
One very simple way to accomplish this would be to use a UIView animation block.
[UIView animateWithDuration:1.0 animations:^{ view.backgroundColor = [UIColor redColor]; }];
This will interpolate between whatever view
's previous background color was, and red over the course of 1 second.
Swift:
UIView.animate(withDuration: 1.0) { view.backgroundColor = .red }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With