Lively Kernel canvas
// this script is evaluated on world load
savefalsenull
10null
5.211127016112927null5.211127016112927
10
null3.3640000000000003null3.3640000000000003
wheel16
speed16
DriveaCar40true
joe'soriginnull
pt(415.6,249.9)
joe'srotationnull
-1.776849450467492
joe'swheelAnglenull
0
joe'sspeednull
0.3640000000000003
2.28038682329848truetrue
0.016515339667585truetrue
0.9956419607695394truetrue1.737042338704309true
commanddragtoturnwheel2
//eingraphischesObjekterstellenbox=Morph.makeRectangle(300,300,50,50);//...undderWelthinzufügenthis.world().addMorph(box)box.name="joe"$morph("joe")//referenzierteineObjektinderWeltmitNamen"joe"box.moveForwardBy(10)box.turnBy(10)truetruefalse
10truetruefalse
false1truefalsetruetruefalse
nullfalsetruenullfalse
Workspacefalsenullfalse
false
false
falsenullfalsefalsenullnullnullnullfalse
//persistentscripts$morph("joe").addScript(functionsetWheelAngle(value){this.wheelAngle=value})$morph("joe").addScript(functionsetSpeed(value){this.speed=value})$morph("joe").addScript(functionsetWheelAngle(value){this.wheelAngle=value})$morph("joe").addScript(functiondriveCar(value){if(!this.owner.bounds().containsRect(this.bounds()))returnif(this.speed)this.moveForwardBy(this.speed)if(this.wheelAngle*this.speed)this.turnBy(this.wheelAngle)})//Connectionsthatcontrolthecarconnect($morph("speedSlider"),'value',$morph('joe'),'setSpeed',{converter:function(value){return(value-3)}})connect($morph("wheelSlider"),'value',$morph('joe'),'setWheelAngle',{converter:function(value){return(value-5)}})connect($morph('wheel'),'rotation',$morph("wheelSlider"),'setValue',{converter:function(value){returnvalue*3}})connect($morph("wheelSlider"),'value',$morph('wheel'),'setRotation',{converter:function(value){return(value/3)}})//Watchersvarpos=pt(300,300)watcher=createWatcher($morph('joe'),'origin');watcher.openInWorld(pos)watcher=createWatcher($morph('joe'),'rotation');pos=pos.addPt(pt(0,50));watcher.openInWorld(pos)watcher=createWatcher($morph('joe'),'wheelAngle');pos=pos.addPt(pt(0,50));watcher.openInWorld(pos)watcher=createWatcher($morph('joe'),'speed');pos=pos.addPt(pt(0,50));watcher.openInWorld(pos)//$morph('joe').attributeConnections.each(function(ea){ea.disconnect()})//$morph('wheel').attributeConnections.each(function(ea){ea.disconnect()})//$morph('wheelSlider').attributeConnections.each(function(ea){ea.disconnect()})54truetruefalsefalse
truetruefalse
false0.11truefalsetruetruefalse
nullfalsetruenullfalse
Workspacefalsenulltruefalse
false
false
falsenullfalsefalsenullnullnullnullfalse
1.5809585500404755
1.5809585500404755
1.5809585500404755
1.5809585500404755
1.5809585500404755
50215.91960749599792
5038.33240780536211
5011.11
501.7315522040732145
501.098580223396094
500
500
500
500
50185.60943274680915
5062.46630790000001
500
500
50320.8939299051159
50188.01424721118565
500
5071.87023956105553-0.633014847292295
04.198
0.211127016112927280.3640000000000003
truenullnull
Wikicontroltruetrue
null66