Chapter 19
Menu Shadow
Give a little visual pop to the radial menu with a simple shadow.
Chapter 19 Contents
After the last chapter’s marathon of coding, this one is a cinch. We need a shadow to appear underneath the menu, so we need 3 things:
- a shadow object
- a reveal animation
- a hide animation
Keeping consistent with the various layers we’re creating as separate C4CanvasController
objects, we’re going to do the same here.
In MenuShadow.swift
simply paste the following into the body of the class:
var reveal : C4ViewAnimation?
var hide : C4ViewAnimation?
public override func setup() {
canvas.frame = C4Rect(UIScreen.mainScreen().bounds)
canvas.backgroundColor = black
canvas.opacity = 0.0
createShadowAnimations()
}
func createShadowAnimations() {
reveal = C4ViewAnimation(duration:0.25) {
self.canvas.opacity = 0.44
}
reveal?.curve = .EaseOut
hide = C4ViewAnimation(duration:0.25) {
self.canvas.opacity = 0.0
}
hide?.curve = .EaseOut
}
That’s it.
Since this class is so simple, we’re not going to test it. We’ll see its effect in the next chapter when we pull the entire menu together.
Here’s a copy of the MenuShadow.swift
class:

Almost There
Seriously, we’re almost done.
You can get through this tutorial.
I believe in you.1