Sprite

An image with a configurable "hot-spot". Transparency and multiple frames in the source image data are rendered appropriately.

Important Limitation: The Sprite bean's support for animated images depends on the underlying implementation of images provided by the Java AWT. This means that, unfortunately, the framerate of animated images is not tied to that of the animation itself. Therefore changing the "time-warp" of the animation will not speed up or slow down the animation of Sprites. So, for applications in which you want to use time-warp, limit sprites to single frames; for applications in which you want to support animated images, don't use time-warp.

Features

XML Element XML Type Java Class
primitive circle uk.ac.ic.doc.scenebeans.Sprite

Properties

Name Type Default Value Getter Method Setter Method Description
src URL null getSrc setSrc The source of image data to be displayed. When specified in an XML document, the URL is relative to that of the document itself.
hotspot Point2D (0,0) getHotspot setHotspot The hotspot of the image: the point on the image, relative to its top-left corner, that is drawn on the origin.
hotspotX double 0 getHotspotX setHotspotX The x coordinate of the hotspot.
hotspotY double 0 getHotspotY setHotspotY The y coordinate of the hotspot.

Example XML

<primitive type="sprite">
  <param name="src" value="background.jpeg"/>
</primitive>