Clear Up
SharpKit Reference

CompositeSprite Class

A composite Sprite handles a group of sprites with common methods to a sprite such as hide, show, setAttributes. These methods are applied to the set of sprites added to the group.

CompositeSprite extends Ext.util.MixedCollection so you can use the same methods in MixedCollection to iterate through sprites, add and remove elements, etc.

In order to create a CompositeSprite, one has to provide a handle to the surface where it is rendered:

  
var group = Ext.create('Ext.draw.CompositeSprite', {
            surface: drawComponent.surface
            });
            

Then just by using MixedCollection methods it's possible to add Ext.draw.Sprites:

  
group.add(sprite1);
            group.add(sprite2);
            group.add(sprite3);
            

And then apply common Sprite methods to them:

  
group.setAttributes({
            fill: '#f00'
            }, true);
            

Namespace: Ext.draw

Derived Types

Methods

Name Description
addCls(JsString) Adds class to all sprites.
animate(object) Performs custom animation on this object. This method is applicable to both the Component class and the Sprite class. It performs animated transitions of certain properties of this object over a specified timeline.
getActiveAnimation() Returns the current animation if this object has any effects actively running or queued, else returns false.
getBBox() Returns the group bounding box. Behaves like Ext.draw.Sprite.getBBox method.
hasActiveFx() Returns the current animation if this object has any effects actively running or queued, else returns false.

This method has been deprecated since 4.0

Replaced by getActiveAnimation

hide(bool) Hides all sprites. If true is passed then a redraw will be forced for each sprite.
redraw() Force redraw of all sprites.
removeCls(JsString) Removes class from all sprites.
sequenceFx() Ensures that all effects queued after sequenceFx is called on this object are run in sequence. This is the opposite of syncFx.
setAttributes(object, bool) Iterates through all sprites calling setAttributes on each one. For more information Ext.draw.Sprite provides a description of the attributes that can be set with this method.
setStyle(JsString) Sets style for all sprites.
show(bool) Shows all sprites. If true is passed then a redraw will be forced for each sprite.
stopAnimation() Stops any running effects and clears this object's internal effects queue if it contains any additional effects that haven't started yet.
stopFx() Stops any running effects and clears this object's internal effects queue if it contains any additional effects that haven't started yet.

This method has been deprecated since 4.0

Replaced by stopAnimation

syncFx() Ensures that all effects queued after syncFx is called on this object are run concurrently. This is the opposite of sequenceFx.
© Copyright 2005-2011 SharpKit. All rights reserved.