Example Code

Googly Eyes in LabVIEW - A Fun Example of the Mouse Move Event

Code and Documents

Attachment

Overview

This example makes use of a custom control which reacts to cursor movement.

 

Description

The custom control is created to represent an eye. Depending on the position of the cursor, an algorithm is created to calculate values that move the eye towards the cursor. This is done by using the mouse move event to determine the position of the mouse cursor. Based on the vertical and horizontal coordinates of the mouse position, the irises of the 2 eyes rotate so that they align the center of the eye to the iris and to the mouse cursor.

 

Requirements

  • LabVIEW 2012 (or compatible).

 

Steps to Implement or Execute Code

  1. Run the program.
  2. Move the mouse on the front panel.
  3. Notice how the eyes move to look towards the cursor.
  4. Press the Stop button to exit.

Additional Information or References 

Block Diagram

capture.JPG

Front Panel

capture2.JPG

Have a look here for an improved (and hilarious) version of this example: https://decibel.ni.com/content/docs/DOC-5073

Here is another googly eyes example that makes use of the NI Vision libraries: https://decibel.ni.com/content/docs/DOC-25399

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.