API Docs for: 2.2.1
Show:

File: pixi/display/Sprite.hx

  1. package pixi.display;
  2. import pixi.filters.AbstractFilter;
  3. import pixi.textures.VideoTexture;
  4. import pixi.textures.Texture;
  5. import pixi.geom.Point;
  6. @:native("PIXI.Sprite")
  7. extern class Sprite extends DisplayObjectContainer {
  8. /**
  9. * The Sprite object is the base for all textured objects that are rendered to the screen
  10. *
  11. * @class Sprite
  12. * @extends DisplayObjectContainer
  13. * @constructor
  14. * @param texture {Texture} The texture for this sprite
  15. *
  16. * A sprite can be created directly from an image like this :
  17. * var sprite = new PIXI.Sprite.fromImage('assets/image.png');
  18. * yourStage.addChild(sprite);
  19. * then obviously don't forget to add it to the stage you have already created
  20. */
  21. @:overload(function(texture:VideoTexture):Void {})
  22. function new(texture:Texture):Void;
  23. /**
  24. * The anchor sets the origin point of the texture.
  25. * The default is 0,0 this means the texture's origin is the top left
  26. * Setting than anchor to 0.5,0.5 means the textures origin is centered
  27. * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner
  28. *
  29. * @property anchor
  30. * @type Point
  31. */
  32. var anchor:Point;
  33. /**
  34. * The texture that the sprite is using
  35. *
  36. * @property texture
  37. * @type Texture
  38. */
  39. var texture:Texture;
  40. /**
  41. * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.
  42. *
  43. * @property tint
  44. * @type Int
  45. * @default 0xFFFFFF
  46. */
  47. var tint:Int;
  48. /**
  49. * The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode.
  50. *
  51. * @property blendMode
  52. * @type Int
  53. * @default PIXI.blendModes.NORMAL;
  54. */
  55. var blendMode:Int;
  56. /**
  57. * The shader that will be used to render the texture to the stage. Set to null to remove a current shader.
  58. *
  59. * @property shader
  60. * @type PIXI.AbstractFilter
  61. * @default null
  62. */
  63. var shader:AbstractFilter;
  64. /**
  65. * Sets the texture of the sprite
  66. *
  67. * @method setTexture
  68. * @param texture {Texture} The PIXI texture that is displayed by the sprite
  69. */
  70. function setTexture(texture:Texture):Void;
  71. /**
  72. *
  73. * Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId
  74. * The frame ids are created when a Texture packer file has been loaded
  75. *
  76. * @method fromFrame
  77. * @static
  78. * @param frameId {String} The frame Id of the texture in the cache
  79. * @return {Sprite} A new Sprite using a texture from the texture cache matching the frameId
  80. */
  81. static function fromFrame(frameId:String):Sprite;
  82. /**
  83. * A short hand way of creating a movieclip from an array of image ids
  84. *
  85. * @static
  86. * @method fromImage
  87. * @param imageId {String}
  88. * @param [crossorigin] {Bool}
  89. * @param [scaleMode] {Int}
  90. * @return {Sprite} A new Sprite using a texture from the texture cache matching the imageId
  91. */
  92. static function fromImage(imageId:String, ?crossorigin:Bool, ?scaleMode:Int):Sprite;
  93. }