Increment Functions in JavaScript: Essential Guide for Artists | p5.js Tutorial
What Make Art What Make Art
19.5K subscribers
55 views
0

 Published On Jan 23, 2024

Welcome to the latest tutorial in the "Programming for Artists" series! In this video, we delve into the world of increment functions, a fundamental concept in coding that can revolutionize the way artists interact with programming.

We start by revisiting the basics of variables in JavaScript, using a practical example of manipulating an ellipse in a p5.js sketch. I explain how manually changing variables like `x` and `y` coordinates can move shapes on the screen, but the real magic of programming lies in automating these changes.

The core of the tutorial focuses on various methods to increment variables, such as addition, subtraction, multiplication, and division. We explore how these changes impact the behavior of the ellipse in our sketch, moving it across the screen and even in diagonal patterns. Through hands-on examples, I demonstrate the use of increment operators (++ and --) and other shorthand methods like += and *= to efficiently update variable values.

Moreover, I guide viewers through the JavaScript documentation to highlight the syntax and usage of these increment operators. This tutorial doesn't just teach the concept; it shows how to practically apply it to creative coding projects.

As we progress, I introduce conditional statements and their role in creating interactive and dynamic art. For instance, we discuss making the ellipse bounce back when it reaches the screen's edge, showcasing the potential of combining incrementation with conditionals.

Join us in this enlightening session and elevate your programming skills. Whether you're an artist looking to add a technical edge to your work or a programmer with a creative flair, this tutorial has something for everyone. Remember to check the JavaScript documentation for more insights, and happy programming!

Timestamps:
0:00 - Introduction to Increment Functions
0:15 - Setting Variables in JavaScript
0:30 - Automating Changes in Variables
1:00 - Increment Operators in JavaScript
1:20 - Practical Example with p5.js Sketch
2:10 - Using Shorthand Methods for Incrementation
3:30 - Applying Incrementation in Creative Coding
3:50 - Conclusion and Further Resources

Remember to like, subscribe, and leave a comment if you found this tutorial helpful. Stay tuned for more content on blending art with programming!

show more

Share/Embed