1 <!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-fx.target.Sprite'>/**
2 </span> * @class Ext.fx.target.Sprite
3 * @extends Ext.fx.target.Target
5 This class represents a animation target for a {@link Ext.draw.Sprite}. In general this class will not be
6 created directly, the {@link Ext.draw.Sprite} will be passed to the animation and
7 and the appropriate target will be created.
12 Ext.define('Ext.fx.target.Sprite', {
14 /* Begin Definitions */
16 extend: 'Ext.fx.target.Target',
22 getFromPrim: function(sprite, attr) {
24 if (attr == 'translate') {
26 x: sprite.attr.translation.x || 0,
27 y: sprite.attr.translation.y || 0
30 else if (attr == 'rotate') {
32 degrees: sprite.attr.rotation.degrees || 0,
33 x: sprite.attr.rotation.x,
34 y: sprite.attr.rotation.y
38 o = sprite.attr[attr];
43 getAttr: function(attr, val) {
44 return [[this.target, val != undefined ? val : this.getFromPrim(this.target, attr)]];
47 setAttr: function(targetData) {
48 var ln = targetData.length,
50 attrs, attr, attrArr, attPtr, spritePtr, idx, value, i, j, x, y, ln2;
51 for (i = 0; i < ln; i++) {
52 attrs = targetData[i].attrs;
54 attrArr = attrs[attr];
56 for (j = 0; j < ln2; j++) {
57 spritePtr = attrArr[j][0];
58 attPtr = attrArr[j][1];
59 if (attr === 'translate') {
65 else if (attr === 'rotate') {
75 degrees: attPtr.degrees,
80 else if (attr === 'width' || attr === 'height' || attr === 'x' || attr === 'y') {
81 value = parseFloat(attPtr);
86 idx = Ext.Array.indexOf(spriteArr, spritePtr);
88 spriteArr.push([spritePtr, {}]);
89 idx = spriteArr.length - 1;
91 spriteArr[idx][1][attr] = value;
95 ln = spriteArr.length;
96 for (i = 0; i < ln; i++) {
97 spritePtr = spriteArr[i];
98 spritePtr[0].setAttributes(spritePtr[1]);
100 this.target.redraw();
103 </pre></pre></body></html>