JScript Animation

Log-in or register.

JScript Animation

Animation is an interface wrapper accessible as a property of the Document object and can be used to access and manipulate frames and other properties of an animation.

Methods and properties

  • uint Frames - number of frames.
  • object GetFrame(uint index) - returns the document object associated with the frame with the given 0-based index. The document will be most likely a LayeredImage.
  • void MoveFrame(uint index, int before) - if before equals -1, the frame is moved to the end.
  • void DeleteFrame(uint index) - removes the frame with the given index from the document.
  • void CopyToFrame(int index, object document) - replaces the document at given frame with a copy of the supplied document. If index is invalid (-1), a new frame is added at the end of the animation.
  • double GetFrameTime(int index) - returns frame duration in milliseconds.
  • void SetFrameTime(int index, double ms) - changes frame duration of given frame.
  • uint LoopCount - loop count of 0 means infinite loop.
  • uint sizeX - width of the animation in pixels (readonly).
  • uint sizeY - height of the animation in pixels (readonly).
  • array GetIndicesFromState(object context, string state) - allows access to frames selected in the GUI by user. Extracts the state with the given ID from the global Context object and returns it as an array of frame indices.
  • void PutIndicesToState(object context, string state, object selectedItems) - selectedItems may be a single frame index or an array of them.

Recent comments

user icon PAEz contributing user on October 27th 2013

For anyone else that needs to know, heres how to get the current slected frame numbers...

var anim = Document.Animation;
var frames=anim.GetIndicesFromState(Context,'FRAME'); // selected frames

var text ='';
text += 'There are ' + frames.length + ' selected frames \r\n';
text += 'Their indexs are...\r\n';
for (var i = 0, end = Math.min(10,frames.length);i<end;i++){
	text += frames[i] + (i==end-1?'':', ');
}
if (end<frames.length) text += '...';

Application.MessageBox(text, "", false);

...hope thats right ;-)...seems to be

user icon Anonymous on July 3rd 2023

'Document.Animation' is null or not an object.
:-(

Me, again, 'anim' is null or not an object

user icon Anonymous
Select background
What about ICL files?