IMoveable and IPanable (Movement objects)
1. Definition
Movement objects are either of type IMoveable or IPanable. They derive from ISlideShowObject.
Movement objects are modifiers of other objects. This way objects can be moved or zoomed. They represent movement paths and camera pans, as known from SlideShow/Stages. Movement objects are lists of objects of type ITimeRect, a data structure, that, in addition to a time mark, stores a number of other properties, like position and angle.
- Moveable: the movement path of the object
- Panable: the camera pan of the object
(IMoveable AND IPanable) inherits from ISlideShowObject function GetItem(Index: Integer): ITimeRect; procedure SetItem(Index: Integer; Item: ITimeRect); function GetCount: Integer; function AddItem: ITimeRect; procedure DeleteItem (const Index: Integer); function IndexOf(const Item: ITimeRect): Integer; procedure SetDefault; function GetMoveAlongPath: Boolean; procedure SetMoveAlongPath (const Value: Boolean); end;
To be able to access these movements the object needs to be cast to IMoveable or IPanable.
var Moveable = Item as IMoveable;
2. Methods
-
Object creation
function CreateMoveableObject: IMoveable; function CreatePanableObject: IPanable;
-
Getter and Setter for the TimeRects
function GetItem(Index: Integer): ITimeRect; procedure SetItem(Index: Integer; Item: ITimeRect);
-
Number of TimeRects
function GetCount: Integer;
-
Adds a new TimeRect, returns a reference to it
function AddItem: ITimeRect;
-
Deletes the TimeRect at position Index
procedure DeleteItem (const Index: Integer);
-
Position of a certain TimeRects
function IndexOf(const Item: ITimeRect): Integer;
-
Deletes all
procedure SetDefault;
-
The Movement object adjusts to the path direction
function GetMoveAlongPath: Boolean; procedure SetMoveAlongPath (const Value: Boolean);
3. Example
var Moveable = SlideShowObject as IMoveable;
if Moveable = nil then
Continue;
Moveable.SetDefault;
Moveable[0].SetLeft(Rect.Left);
Moveable[0].SetTop(Rect.Top);
Moveable[0].SetRight(Rect.Right);
Moveable[0].SetBottom(Rect.Bottom);
TimeRect = Moveable.AddItem;