Learn creative coding writing simple programs

33. Use multiplication to scale up or down speeds and sizes

Multiplication is something we often use in our programs, so it's important to feel comfortable with it. In programming languages, the sign used for multiplication is the asterisk: *. When we multiply any number by 1, we get the same number: 77 * 1 = 77. When we multiply by a number larger than 1, we get a number larger than the original number: 77 * 1.2 = 92.4. When we multiply by a positive number smaller than 1, we make it smaller: 77 * 0.8 = 61.6. Knowing these simple rules we create a program where objects move a different speeds. We also update the program we created with 5 rotating rectangles to give each rectangle a different rotation speed.

Tags: multiplication, scale, scalin

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus