Coding Challenge #4 Lightning Effect



In this coding challenge I created a lightning effect.

script type="text/javascript" src="http://aos-creative.prf.hn/creative/camref:100l3Rd/creativeref:10l3694">

This effect uses both object oriented program along with recursion. Each fork of lightning is its own object and is recursively updated and displayed.

Recursion is essentially just a function that calls itself until some base condition is met. In this case, when each branch of lightning is updated, it also updates its children. The base condition is that the branch is the last one (the lightning is given a ‘maximum level’ which indicates how many layers of branching to produce.

Hope you enjoy the episode!

Make sure to check out the links below, they’ve got everything you need to get started!

Check out the files from this challenge on github: https://github.com/BarneyWhiteman/CodingChallenges

Vote for new topics here: http://barneyw.net/youtube.html

Get Processing from here: https://processing.org/ Check out the rest of the Coding Challenges here:

Help support my channel:
buymeacoff.ee/Barney

source

Reply


Build A Site Info