Class: Sketchup::FrameChangeObserver Abstract
Implement the methods described in this class to create a frame change observer. You can not sub-class this class because it is not defined by the API.
This observer interface is implemented to react to changes in camera position (a frame) between one scene page and another. This observer's callback method is called when the user manually makes a scene change, or the internal animation feature runs.
This abstract observer is any object that implements a callback method
frameChange with 3 arguments:
from_scene (the scene that you transition from),
to_scene (the scene that you transition toward) and a
1.0 (that indicates the percentage of transition between the two scenes.)
# Basic Class Definition: class MyFrameChangeObserver def frameChange(from_scene, to_scene, percent_done) # Actual code here. end end
The observer is attached using theclass method, which returns an integer id that can be stored and later used to detach the observer.
# Attach an observer to the global Pages object: @id = ::.(MyFrameChangeObserver.new)
Later, detaching this observer is done by passing this
id reference to the class method.
# Basic Observer Detachment: ::.(@id)
#frameChange(from_scene, to_scene, percent_done) ⇒ void
This callback method is called during a slide show or creation of an animation after the camera has been set up, but before the frame is displayed.
Instance Method Details
↑ #frameChange(from_scene, to_scene, percent_done) ⇒ void
from_scene argument into this callback does not appear to be populated on the PC. You can store a variable that keeps track of the
to_scene and then use that on a subsequent Scene selection to determine the last Page that the user was on.
This method returns an undefined value.
This callback method is called during a slide show or creation of an animation after the camera has been set up, but before the frame is displayed. It gives you a chance to perform your own actions during the animation. The arguments for
frameChange method are the scene page that you transition from (
from_scene), the scene page that you transition to (
to_scene), and a
1.0 that tell you the percentage of the transition between the two scene pages.
By watching for percent_done >= 1.0, you can activate Ruby code that executes as soon as the user's camera has finished animating.