You have either attached the drawable "weatherWidget" to a AR.GeoObject or AR.Trackable2DObject depending on if you are using Geo based AR or image recognition.
Both of these objects have an onEnterFieldOfVision trigger property that you can assign a function to. This function will be executed when the object becomes visible in the field of view.
Here is a quick example for doing what you asked assuming you are using image recognition.
over 9 years ago
You can use the AR.Trackable2dObject's onEnterFieldOfVision and onExitFieldOfVision triggers to start and pause the animation whenever a target is recognized (onEnter..) or is lost (onExit...).
See the JS API Reference that comes with the SDK for details on the API. Examples that make use of the enter/ExitFieldOfVision triggers is e.g. the Video Example 6-2.