Lively Kernel canvas
null
null
1000
2.6919597959942267
Wikicontrol
true
0
null
null
1000
0.13528189175969263
Wikicontrol
true
0
null
null
1000
1.6922796108322946
Wikicontrol
true
0
null
null
1000
0.2549660820906037
Wikicontrol
true
0
null
null
1000
0.5739627593642067
Wikicontrol
true
0
null
null
1000
2.12768750687352
Wikicontrol
true
0
null
null
1000
0.03116387903474515
Wikicontrol
true
0
null
null
1000
0.11143051549700675
Wikicontrol
true
0
null
null
1000
1.5529674606261052
Wikicontrol
true
null
null
1000
0.3486917074096547
Wikicontrol
true
null
null
1000
0.7457787010412045
Wikicontrol
true
null
null
1000
0.3021287780369298
Wikicontrol
true
null
null
1000
0.7290021634584054
Wikicontrol
true
null
null
1000
1.642214100899319
Wikicontrol
true
null
null
1000
2.575854747631249e-7
Wikicontrol
true
null
null
1000
1.0823078697156532
Wikicontrol
true
null
Prev
14
2
false
null
1
null
null
(15)ScriptingObjectswithTimers
18
21
true
null
20
null
0
null
null
Top
14
3
false
null
1
null
null
null
1000
0.0000036750734975601756
Wikicontrol
true
null
null
1000
0.44566006192940305
Wikicontrol
true
null
null
1000
1.116868091184117
Wikicontrol
true
null
null
1000
0.002548374094455272
Wikicontrol
true
null
null
1000
0.11696890143849986
Wikicontrol
true
null
null
1000
1.8879547786188358
Wikicontrol
true
null
AlltheObjectsintheLivelyKernelcanbescriptedusingtimers.TimersareJavaScriptfunctionsthatareinvokedperiodicallyforthegivenobjects.Forinstance,intheexamplebelowweareusingtimerstorotateanumberofstartsthathavebeendefinedasPolygonShapeobjects.Wehavealsocreatedaclockthatmovesandrotatesitselfasitticks.
14
4
123
true
null
0
null
null
null
Next
14
4
false
null
1
null
null
null
1000
0.006689351755438746
Wikicontrol
true
null
null
1000
2.2187110094452076
Wikicontrol
true
null
null
1000
1.96367259416794
Wikicontrol
true
null
null
1000
0.3928126557770264
Wikicontrol
true
null
null
1000
1.452416994160042
Wikicontrol
true
null
null
Notes:Alltheusualobjecteditingcapabilitiescanbeappliedtotimedobjects.Forinstance,youcaneditthetextinthelabelsbeloworreshapethepolygonsonthefly.
14
34
false
177
null
null
5
null
null
null
Tryityourself!Takealookatthesourcecodeofthisdemotoseehowtocreatescriptedobjects.Whilelookingatthedemoinaction,tryeditingthetextlabelsaswellasgrabbingthehandlesofthestarswhilethestarsarerotating.
14
5
102
false
0
null
null
null
null
1000
0.22885228220250178
Wikicontrol
true
null
null
1000
3.517695846570223
Wikicontrol
true
null
null
varmakeStarVertices=function(r,center,startAngle){varvertices=[];varnVerts=10;for(vari=0;i<=nVerts;i++){vara=startAngle+(2*Math.PI/nVerts*i);varp=Point.polar(r,a);if(i%2==0)p=p.scaleBy(0.39);vertices.push(p.addPt(center));}returnvertices;}varwidget=Morph.makePolygon(makeStarVertices(50,pt(0,0),0),1,Color.black,Color.yellow);widget.setPosition(pt(125,475));WorldMorph.current().addMorph(widget);widget.startStepping(50,"rotateBy",0.1);//Addalabeltothestarvarwidget2=newTextMorph(pt(10,10).extent(pt(150,50)),"I'musingatimer...");widget2.setFontSize(20);widget.addMorph(widget2);//Createtwoadditionalcopiesoftheobjectthatwejustcreatedvarcopy=widget.copy();WorldMorph.current().addMorph(copy);copy.moveBy(pt(300,0));//Placethesecondcopyontopofthepreviousone(justforfun...)varcopy2=copy.copy();//copy2.setPosition(pt(0,0));copy.addMorph(copy2);//Addaclockthatrotatesandmovesslowlyasitticksvarclock=newClockMorph(pt(100,540),50);WorldMorph.current().addMorph(clock);clock.startStepping(1000,"rotateBy",0.1);clock.startStepping(1000,"moveBy",pt(10,0));clock.startSteppingScripts();
3
133
false
null
96
null
null
0.1
50
38.99241000000001
null
I'musingatimer...
1
20
null
2.2168146928204164
0.1
50
0
null
null
null
I'musingatimer...
1
20
null
0.1
50
33.429601
0.1
50
0
null
null
null
null
I'musingatimer...
1
20
0.1
50
0
null
null
0.1
50
41.28192000000001
2.2168146928204164
null
2.2168146928204164
null
null
XII
8
null
null
I
8
null
null
II
8
null
null
III
8
null
null
IV
8
null
null
V
8
null
null
VI
8
null
null
VII
8
null
null
VIII
8
null
null
IX
8
null
null
X
8
null
null
XI
8
null
null
6.7772589295983146
null
5.928883469024737
null
3.8746309394274117
null
0.1
1000
3.741931
null
1000
0.6561000000000001
null
1000
4.317031
null
0.6
null
1231412197084
1064
1
30
1231412197
null
null