Chapter 3 challenge, just for fun a little randomness

Add this line of code after line 187 in ViewController.swift and the clouds will start their animation at a different y position.
cloud.frame.origin.y = CGFloat.random(in: 100..<self.view.frame.size.height-200)

You could do the same with the speed to create the illusion of depth. Replace line 182 with:
let cloudSpeed = CGFloat.random(in: 30.0..<120.0) / view.frame.size.width

@armandzwan Thank you for sharing this - much appreciated! :]

This topic was automatically closed after 166 days. New replies are no longer allowed.