Front Panel Picture Control (v3)

Content

This takes a Front Panel Picture Cotnrol and adds random balls (determined by the user before beginning) and moves them around the screen.  The position and direction they are heading (x-pos, y-pos, x-dir, y-dir) is determined by the cluster values stored in an array (one cluster per ball).  The direction, for both x and y, is either +1 (positive) or -1 (negative).  This value is then multiplied by the "Speed" in order to allow the user to "speed up" how the balls move in real time.  Also, the size of the Picture Display is used as a variable (width, height) so that it can be resized and the bouncing still works.

Code

 This is what the Front Panel Picture Control looks like.

Code

Here is the code that runs this animation in the background. 

Code

Here is "Version 2".  This combines the code from How Do I ... Front Panel Picture Control (pt 2) (version 3, where the balls disappear) and the "bouncing balls" code above.  It also adds: second motor control, for controlling the y-position of the red-dot, controls over the size of the balls (and better "overlap detection" that uses the radius distance instead of a bounding box), a timer to indicate how long to eliminate the balls, and actually deletes the balls from the array (instead of just moving off screen).  View the code (v2 below) to see the changes and how this all works.

Leave a Reply

Your email address will not be published. Required fields are marked *