Hi, if anyone has access to the textbook ‘Animation in HTML, CSS and JavaScript’, would you happen to know what the purpose of the following variables are in the script for Chapter 15 ‘Animating Many Things’ and also what their names allude to?
signHelper is used to determine the value of sign which is either negative or positive, as numeric signs go. It’s not used for any other purpose, so it’s just a one-time, temporary helper variable that is randomly generated and checked to see if sign should be 1 (positive) or -1 (negative). sign determines direction as it affects…
counter is a generic name for a value that either increases or decreases over time. You know, it “counts”. Counters can be used for many different things, one of which is driving animation, either by acting as a frame counter as it indicates progression through a timeline, or simply being a value that animated properties are derived from, which is the case here. X and y changes are based on counter, going around the circumference of a circle as the value of counter changes. And sign determines if counter counts up (+) or down (-) or clockwise vs counterclockwise.