So I can't get this to work. The xScale factor should be animated. It works in C++ but not QtScript. You will need qt-master and the latest bindings generator (4.6 branch)
The only message I get is "QPropertyAnimation::updateState: Changing state of an animation without target"

http://pastebin.com/m51cee344
or
Qt Code:
  1. function GraphicsItemPropertyProxy (item, parent)
  2. {
  3. //QObject.call(parent);
  4. this.item = item;
  5. this._xScale = 1;
  6. }
  7.  
  8. GraphicsItemPropertyProxy.prototype = new QObject();
  9. GraphicsItemPropertyProxy.__defineGetter__("xScale", function() { return this._xScale; });
  10. GraphicsItemPropertyProxy.__defineSetter__("xScale",
  11. function(v) {
  12. print("setting xScale to", v);
  13. this._xScale = v;
  14. this.updateTransform();
  15. return v;
  16. }
  17. );
  18. GraphicsItemPropertyProxy.prototype.updateTransform=function() {
  19. print("updateTransform()");
  20. this.item.setTransform(new QTransform().translate(0,0)
  21. .rotate(0, Qt.ZAxis)
  22. .rotate(0, Qt.YAxis)
  23. .rotate(0, Qt.XAxis)
  24. .scale(this._xScale, 5)
  25. .translate(0, 0));
  26. }
  27.  
  28. function AffineTextItem(text, font, brush, parent)
  29. {
  30. QGraphicsItem.call(this, parent);
  31. var fm = new QFontMetrics(font);
  32.  
  33. this.path = new QPainterPath();
  34. this.brush=brush;
  35. this.path.addText(0,fm.ascent(), this.font, text);
  36. this.br = fm.boundingRect(text).adjusted(0,0,0, fm.ascent());
  37. this.boundingRect = function() { return this.br; };
  38. }
  39.  
  40. AffineTextItem.prototype = new QGraphicsItem();
  41.  
  42. AffineTextItem.prototype.paint = function (painter, options, widget)
  43. {
  44. if (this.opacity()==0)
  45. return;
  46. painter.fillPath(this.path, this.brush);
  47. }
  48.  
  49.  
  50. var scene = new QGraphicsScene();
  51. scene.setSceneRect(0,0, 900, 500);
  52.  
  53.  
  54. var item = new AffineTextItem("this is text", new QFont("Arial", 25), new QColor(255,0,0));
  55. item.setOpacity(0.75);
  56. scene.addItem(item);
  57. var proxy = new GraphicsItemPropertyProxy(item);
  58. var animX = new QPropertyAnimation(proxy, "xScale");
  59. animX.startValue = 50.0;
  60. animX.endValue = 10.0;
  61. animX.duration = 5000.0;
  62. animX.loopCount = -1;
  63.  
  64. var view = new QGraphicsView(scene);
  65. view.renderHints = (QPainter.Antialiasing | QPainter.SmoothPixmapTransform | QPainter.TextAntialiasing);
  66.  
  67. var blueGradient = new QLinearGradient (0,0,0,1080);
  68. blueGradient.setColorAt(0, new QColor(0,255,0));
  69. blueGradient.setColorAt(1, new QColor(0,0,255));
  70.  
  71. view.backgroundBrush = new QBrush(blueGradient);
  72. animX.start();
  73. view.resize(960, 540);
  74. view.show();
To copy to clipboard, switch view to plain text mode