{"id":0,"registry":{"0":{"submorphs":[{"__isSmartRef__":true,"id":1}],"scripts":[{"__isSmartRef__":true,"id":6}],"shape":{"__isSmartRef__":true,"id":7},"eventHandler":{"__isSmartRef__":true,"id":8},"_ClipMode":"visible","derivationIds":["EC7EBB28-54AE-4244-80ED-3E13650F82B7"],"id":"F32C4C3F-C3BC-42E3-A4C3-FE9A247E3328","grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"value":false,"toggle":false,"isActive":true,"label":{"__isSmartRef__":true,"id":1},"_PreviousBorderWidth":1,"isPressed":false,"showsHalos":false,"attributeConnections":[{"__isSmartRef__":true,"id":9}],"doNotSerialize":["$$fire"],"doNotCopyProperties":["$$fire"],"name":"EllipseMaker","partsBinMetaInfo":{"__isSmartRef__":true,"id":11},"_Rotation":0,"_Scale":1,"ellipses":[],"repRate":200,"lastTick":1365017124386,"shiftIsDown":false,"__serializedExpressions__":["_Position","distanceToDragEvent"],"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":21},"__LivelyClassName__":"lively.morphic.Button","__SourceModuleName__":"Global.lively.morphic.Widgets","_Position":"lively.pt(0.0,0.0)","distanceToDragEvent":"lively.pt(74.0,7.0)"},"1":{"submorphs":[],"scripts":[],"shape":{"__isSmartRef__":true,"id":2},"_WhiteSpaceHandling":"pre-wrap","textChunks":[{"__isSmartRef__":true,"id":3}],"eventHandler":{"__isSmartRef__":true,"id":5},"_ClipMode":"hidden","derivationIds":["7884E73F-0D17-44B3-907F-44A5223F1F3D"],"id":"48A0285C-121C-4D77-9027-6218FDD5C7CE","grabbingEnabled":false,"droppingEnabled":false,"halosEnabled":true,"fixedWidth":true,"_WordBreak":"break-all","fixedHeight":true,"_InputAllowed":false,"_HandStyle":"default","allowInput":false,"_FontFamily":"Helvetica","_FontSize":10,"evalEnabled":false,"owner":{"__isSmartRef__":true,"id":0},"isLabel":true,"_Align":"center","eventsAreIgnored":true,"_TextStylingMode":true,"showsHalos":false,"eventsAreDisabled":true,"_PointerEvents":"none","__serializedExpressions__":["_TextColor"],"__LivelyClassName__":"lively.morphic.Text","__SourceModuleName__":"Global.lively.morphic.TextCore","_TextColor":"Color.rgb(0,0,0)"},"2":{"_BorderWidth":0,"_Fill":null,"__serializedExpressions__":["_Position","_Extent","_Padding","_BorderColor"],"__LivelyClassName__":"lively.morphic.Shapes.Rectangle","__SourceModuleName__":"Global.lively.morphic.Shapes","_Position":"lively.pt(0.0,0.0)","_Extent":"lively.pt(130.0,22.0)","_Padding":"lively.rect(0,3,0,0)","_BorderColor":"Color.rgb(0,0,0)"},"3":{"style":{"__isSmartRef__":true,"id":4},"chunkOwner":{"__isSmartRef__":true,"id":1},"_id":"_524","storedString":"Make ellipses (0)","__LivelyClassName__":"lively.morphic.TextChunk","__SourceModuleName__":"Global.lively.morphic.TextCore"},"4":{"textShadow":"0px 1px 0 rgba(255,255,255,1)","__LivelyClassName__":"lively.morphic.TextEmphasis","__SourceModuleName__":"Global.lively.morphic.TextCore"},"5":{"morph":{"__isSmartRef__":true,"id":1},"__LivelyClassName__":"lively.morphic.EventHandler","__SourceModuleName__":"Global.lively.morphic.Events"},"6":{"target":{"__isSmartRef__":true,"id":0},"selector":"nextStep","args":[],"stopped":false,"tickTime":30,"suspended":false,"__LivelyClassName__":"lively.morphic.TargetScript","__SourceModuleName__":"Global.lively.morphic.Core"},"7":{"_BorderWidth":1,"_BorderRadius":5,"_AppearanceStylingMode":true,"_BorderStylingMode":true,"__serializedExpressions__":["_Position","_Extent","_Padding","_BorderColor"],"__LivelyClassName__":"lively.morphic.Shapes.Rectangle","__SourceModuleName__":"Global.lively.morphic.Shapes","_Position":"lively.pt(0.0,0.0)","_Extent":"lively.pt(130.0,22.0)","_Padding":"lively.rect(0,0,0,0)","_BorderColor":"Color.rgb(189,190,192)"},"8":{"morph":{"__isSmartRef__":true,"id":0},"__LivelyClassName__":"lively.morphic.EventHandler","__SourceModuleName__":"Global.lively.morphic.Events"},"9":{"sourceObj":{"__isSmartRef__":true,"id":0},"sourceAttrName":"fire","targetObj":{"__isSmartRef__":true,"id":0},"targetMethodName":"doAction","varMapping":{"__isSmartRef__":true,"id":10},"__LivelyClassName__":"AttributeConnection","__SourceModuleName__":"Global.lively.bindings.Core"},"10":{"source":{"__isSmartRef__":true,"id":0},"target":{"__isSmartRef__":true,"id":0}},"11":{"partName":"EllipseMaker","requiredModules":[],"partsSpaceName":"PartsBin/Demos","comment":"A button that makes spinning moving bouncing ellipses when pressed.  \nShift key down causes them to be removed.\nCan be a useful measure of performance in combination with FrameRateMorph.\nNote that the ellipses bounce inside the bounds of the button's owner which can be other than the world (like maybe a Kaleidoscope segment)","changes":[{"__isSmartRef__":true,"id":12},{"__isSmartRef__":true,"id":14},{"__isSmartRef__":true,"id":16},{"__isSmartRef__":true,"id":18}],"migrationLevel":4,"lastModifiedDate":{"__isSmartRef__":true,"id":20},"revisionOnLoad":194726,"__LivelyClassName__":"lively.PartsBin.PartsBinMetaInfo","__SourceModuleName__":"Global.lively.PartsBin"},"12":{"date":{"__isSmartRef__":true,"id":13},"author":null,"message":"no comment","id":"F8B70225-5143-4A51-ABB4-344B488B3811"},"13":{"isSerializedDate":true,"string":"Tue Dec 11 2012 13:15:42 GMT-0800 (PST)"},"14":{"date":{"__isSmartRef__":true,"id":15},"author":"robertkrahn","message":"no comment","id":"9B8B6BE4-4519-4A6C-8F47-70DE61BBB0FB"},"15":{"isSerializedDate":true,"string":"Tue Dec 11 2012 13:53:16 GMT-0800 (PST)"},"16":{"date":{"__isSmartRef__":true,"id":17},"author":"Dan","message":"Worked once -- it must be right","id":"95D81397-9A58-4027-821E-8EC7773C660F"},"17":{"isSerializedDate":true,"string":"Mon Apr 01 2013 23:32:22 GMT-0700 (PDT)"},"18":{"date":{"__isSmartRef__":true,"id":19},"author":"Dan","message":"Used super instead of the hack I had on onMouseDown","id":"F4C28D4D-D727-421B-9E4F-DB93E80DF5BA"},"19":{"isSerializedDate":true,"string":"Wed Apr 03 2013 12:28:12 GMT-0700 (PDT)"},"20":{"isSerializedDate":true,"string":"Mon Apr 01 2013 23:30:12 GMT-0700 (PDT)"},"21":{"doAction":{"__isSmartRef__":true,"id":22},"makeNewEllipse":{"__isSmartRef__":true,"id":26},"nextStep":{"__isSmartRef__":true,"id":30},"report":{"__isSmartRef__":true,"id":34},"reset":{"__isSmartRef__":true,"id":38},"stepEllipses":{"__isSmartRef__":true,"id":42},"onMouseDown":{"__isSmartRef__":true,"id":46}},"22":{"varMapping":{"__isSmartRef__":true,"id":23},"source":"function doAction() {\n    \n}","funcProperties":{"__isSmartRef__":true,"id":24},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"23":{"this":{"__isSmartRef__":true,"id":0}},"24":{"timestamp":{"__isSmartRef__":true,"id":25},"user":"undefined","tags":[]},"25":{"isSerializedDate":true,"string":"Tue Dec 11 2012 13:14:29 GMT-0800 (PST)"},"26":{"varMapping":{"__isSmartRef__":true,"id":27},"source":"function makeNewEllipse() {\n    // Test here if shift down and if so remove an ellipse and report\n    if (this.shiftIsDown) {\n        if (this.ellipses.length > 0) this.ellipses.pop().remove();\n        return this.report();\n        }\n    var ext = this.owner.innerBounds().extent();\n    var s = Math.min(ext.x/40, ext.y/40, 20);\n    var e = lively.morphic.Morph.makeEllipse(new Rectangle(0, 0, 2*s, 4*s));\n    e.applyStyle({ fill: Color.random(), fillOpacity: Math.random(), borderWidth: 1, borderColor: Color.random()});\n    e.velocity = pt(s, s).random();\n    e.angularVelocity = 0.3 * Math.random();\n    this.owner.addMorph(e);\n    this.ellipses.push(e);\n    this.report();\n}","funcProperties":{"__isSmartRef__":true,"id":28},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"27":{"this":{"__isSmartRef__":true,"id":0}},"28":{"timestamp":{"__isSmartRef__":true,"id":29},"user":"Dan","tags":[]},"29":{"isSerializedDate":true,"string":"Mon Apr 01 2013 22:40:13 GMT-0700 (PDT)"},"30":{"varMapping":{"__isSmartRef__":true,"id":31},"source":"function nextStep() {\n    this.stepEllipses();\n    if (!this.isPressed) return;\n    var thisTick = new Date().getTime();\n    if (thisTick - this.lastTick < this.repRate) return;\n    this.makeNewEllipse();\n    this.lastTick = thisTick;\n}","funcProperties":{"__isSmartRef__":true,"id":32},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"31":{"this":{"__isSmartRef__":true,"id":0}},"32":{"timestamp":{"__isSmartRef__":true,"id":33},"user":"Dan","tags":[]},"33":{"isSerializedDate":true,"string":"Mon Apr 01 2013 22:14:17 GMT-0700 (PDT)"},"34":{"varMapping":{"__isSmartRef__":true,"id":35},"source":"function report() {\n    this.setLabel(\"Make ellipses (\" + this.ellipses.length + \")\");\n}","funcProperties":{"__isSmartRef__":true,"id":36},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"35":{"this":{"__isSmartRef__":true,"id":0}},"36":{"timestamp":{"__isSmartRef__":true,"id":37},"user":"Dan","tags":[]},"37":{"isSerializedDate":true,"string":"Mon Apr 01 2013 22:21:09 GMT-0700 (PDT)"},"38":{"varMapping":{"__isSmartRef__":true,"id":39},"source":"function reset() {  // this.reset()\n    // Under construction -- will be a button that emits bouncing ellipses\n    // to test graphical performance in conjunction with FrameRateMorph\n    this.setExtent(pt(130, 22));\n    this.ellipses = [];\n    this.report();\n    this.repRate = 200; // ms\n    this.lastTick = new Date().getTime();\n    this.startStepping(30,'nextStep'); \n}","funcProperties":{"__isSmartRef__":true,"id":40},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"39":{"this":{"__isSmartRef__":true,"id":0}},"40":{"timestamp":{"__isSmartRef__":true,"id":41},"user":"Dan","tags":[]},"41":{"isSerializedDate":true,"string":"Mon Apr 01 2013 22:22:25 GMT-0700 (PDT)"},"42":{"varMapping":{"__isSmartRef__":true,"id":43},"source":"function stepEllipses() {\n    this.ellipses.forEach( function(e) { e.stepAndBounce(); });\n}","funcProperties":{"__isSmartRef__":true,"id":44},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"43":{"this":{"__isSmartRef__":true,"id":0}},"44":{"timestamp":{"__isSmartRef__":true,"id":45},"user":"Dan","tags":[]},"45":{"isSerializedDate":true,"string":"Mon Apr 01 2013 22:14:17 GMT-0700 (PDT)"},"46":{"varMapping":{"__isSmartRef__":true,"id":47},"source":"function onMouseDown(evt) {\n    this.shiftIsDown = evt.isShiftDown();\n    return $super(evt);\n}","funcProperties":{"__isSmartRef__":true,"id":52},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"47":{"this":{"__isSmartRef__":true,"id":0},"__serializedLivelyClosures__":{"__isSmartRef__":true,"id":48}},"48":{"$super":{"__isSmartRef__":true,"id":49}},"49":{"varMapping":{"__isSmartRef__":true,"id":50},"source":"function () {\n                    try {\n                        return obj.constructor.prototype[name].apply(obj, arguments)\n                    } catch (e) {\n                        if ($world)\n                            $world.logError(e, 'Error in $super call')\n                        else\n                            alert('Error in $super call: ' + e + '\\n' + e.stack);\n                        return null;\n                    }\n                }","funcProperties":{"__isSmartRef__":true,"id":51},"__LivelyClassName__":"lively.Closure","__SourceModuleName__":"Global.lively.lang.Closure"},"50":{"obj":{"__isSmartRef__":true,"id":0},"name":"onMouseDown"},"51":{},"52":{"timestamp":{"__isSmartRef__":true,"id":53},"user":"Dan","tags":[]},"53":{"isSerializedDate":true,"string":"Wed Apr 03 2013 12:24:18 GMT-0700 (PDT)"},"isSimplifiedRegistry":true}}