Visual Home Home

Let be this.*

"this." is going to be around us from this page onwards. "this" in js has many purposes. In object oriented programming, "this" is used to refer to the data that is inside the Object declaration / cookie cutter

Classes

Why is one circle alone is standing still, while other two are vibrating. That bubble has not been given the ability to move. Literally speaking, the move() function is not "attached" to that object.

More Tables

Generating tables with functions is one way. The other way is to create Object called table and create instances like how we have done for the circles. In case of tables, we can do more than just create them, we can operate on them.

Creating new colors randomly is an action. These are called methods in object oriented programming. These methods add functionality, like in this case, table colors are changing. We can extend the change to any variable that we are imagining. P5 editor that I am using has ways to add files to its working space. The classes that are created can be kept in seperate files which can then be referenced in the main script.