Processing-Examples.deploy.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. (function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Processing-Examples');
  3. smalltalk.addClass('ProcessingClock', smalltalk.Object, ['processing', 'centerX', 'centerY', 'maxArmLength'], 'Processing-Examples');
  4. smalltalk.addMethod(
  5. smalltalk.method({
  6. selector: "draw",
  7. fn: function (){
  8. var self=this;
  9. var drawBlock;
  10. function $Date(){return smalltalk.Date||(typeof Date=="undefined"?nil:Date)}
  11. return smalltalk.withContext(function($ctx1) {
  12. var $1;
  13. drawBlock=(function(){
  14. var now,hoursPosition,minutesPosition,secondsPosition;
  15. return smalltalk.withContext(function($ctx2) {
  16. _st(self["@processing"])._background_((224));
  17. now=_st($Date())._new();
  18. now;
  19. hoursPosition=_st(_st(_st(_st(now)._hours()).__backslash_backslash((12))).__plus(_st(_st(now)._minutes()).__slash((60)))).__slash((12));
  20. hoursPosition;
  21. self._drawArm_lengthScale_weight_(hoursPosition,(0.5),(5));
  22. minutesPosition=_st(_st(_st(now)._minutes()).__plus(_st(_st(now)._seconds()).__slash((60)))).__slash((60));
  23. minutesPosition;
  24. self._drawArm_lengthScale_weight_(minutesPosition,(0.8),(3));
  25. secondsPosition=_st(_st(now)._seconds()).__slash((60));
  26. secondsPosition;
  27. return self._drawArm_lengthScale_weight_(secondsPosition,(0.9),(1));
  28. }, function($ctx2) {$ctx2.fillBlock({now:now,hoursPosition:hoursPosition,minutesPosition:minutesPosition,secondsPosition:secondsPosition},$ctx1)})});
  29. $1=drawBlock;
  30. return $1;
  31. }, function($ctx1) {$ctx1.fill(self,"draw",{drawBlock:drawBlock},smalltalk.ProcessingClock)})},
  32. messageSends: ["background:", "new", "/", "+", "minutes", "\x5c\x5c", "hours", "drawArm:lengthScale:weight:", "seconds"]}),
  33. smalltalk.ProcessingClock);
  34. smalltalk.addMethod(
  35. smalltalk.method({
  36. selector: "drawArm:lengthScale:weight:",
  37. fn: function (aPosition,aLengthScale,aWeight){
  38. var self=this;
  39. var myDX,myDY;
  40. function $Math(){return smalltalk.Math||(typeof Math=="undefined"?nil:Math)}
  41. return smalltalk.withContext(function($ctx1) {
  42. _st(self["@processing"])._strokeWeight_(aWeight);
  43. myDX=_st(self["@centerX"]).__plus(_st(_st(_st($Math())._sin_(_st(_st(aPosition).__star((2))).__star(_st($Math())._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
  44. myDY=_st(self["@centerY"]).__minus(_st(_st(_st($Math())._cos_(_st(_st(aPosition).__star((2))).__star(_st($Math())._PI()))).__star(aLengthScale)).__star(self["@maxArmLength"]));
  45. _st(self["@processing"])._line_y_dX_dy_(self["@centerX"],self["@centerY"],myDX,myDY);
  46. return self}, function($ctx1) {$ctx1.fill(self,"drawArm:lengthScale:weight:",{aPosition:aPosition,aLengthScale:aLengthScale,aWeight:aWeight,myDX:myDX,myDY:myDY},smalltalk.ProcessingClock)})},
  47. messageSends: ["strokeWeight:", "+", "*", "sin:", "PI", "-", "cos:", "line:y:dX:dy:"]}),
  48. smalltalk.ProcessingClock);
  49. smalltalk.addMethod(
  50. smalltalk.method({
  51. selector: "firstProcessingInstance",
  52. fn: function (){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. return Processing.instances[0];
  56. return self}, function($ctx1) {$ctx1.fill(self,"firstProcessingInstance",{},smalltalk.ProcessingClock)})},
  57. messageSends: []}),
  58. smalltalk.ProcessingClock);
  59. smalltalk.addMethod(
  60. smalltalk.method({
  61. selector: "initialize",
  62. fn: function (){
  63. var self=this;
  64. function $Math(){return smalltalk.Math||(typeof Math=="undefined"?nil:Math)}
  65. return smalltalk.withContext(function($ctx1) {
  66. self["@processing"]=self._firstProcessingInstance();
  67. self["@centerX"]=_st(_st(self["@processing"])._width()).__slash((2));
  68. self["@centerY"]=_st(_st(self["@processing"])._height()).__slash((2));
  69. self["@maxArmLength"]=_st($Math())._min_or_(self["@centerX"],self["@centerY"]);
  70. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ProcessingClock)})},
  71. messageSends: ["firstProcessingInstance", "/", "width", "height", "min:or:"]}),
  72. smalltalk.ProcessingClock);
  73. smalltalk.addMethod(
  74. smalltalk.method({
  75. selector: "processing",
  76. fn: function (){
  77. var self=this;
  78. return smalltalk.withContext(function($ctx1) {
  79. var $1;
  80. $1=self["@processing"];
  81. return $1;
  82. }, function($ctx1) {$ctx1.fill(self,"processing",{},smalltalk.ProcessingClock)})},
  83. messageSends: []}),
  84. smalltalk.ProcessingClock);
  85. smalltalk.addMethod(
  86. smalltalk.method({
  87. selector: "init",
  88. fn: function (){
  89. var self=this;
  90. var clock,processing,block;
  91. function $ProcessingClock(){return smalltalk.ProcessingClock||(typeof ProcessingClock=="undefined"?nil:ProcessingClock)}
  92. return smalltalk.withContext(function($ctx1) {
  93. clock=_st($ProcessingClock())._new();
  94. processing=_st(clock)._processing();
  95. block=_st(clock)._draw();
  96. _st(processing)._at_put_("draw",block);
  97. return self}, function($ctx1) {$ctx1.fill(self,"init",{clock:clock,processing:processing,block:block},smalltalk.ProcessingClock.klass)})},
  98. messageSends: ["new", "processing", "draw", "at:put:"]}),
  99. smalltalk.ProcessingClock.klass);
  100. })(global_smalltalk,global_nil,global__st);