sims.experimental.BlankSlateApp

previous next

BlankSlateApp has a LabCanvas and Terminal, and lets you experiment building things with scripts. Here is a sample script to try:

var r = PointMass.makeSquare(4);
var dr = new DisplayShape(r).setStrokeStyle('red').setThickness(4);
displayList.add(dr);
r.setPosition(new Vector(0, 0));
var clock = new Clock();
var timer = new Timer();
var callback = function () {
    r.setAngle(Math.sin(clock.getTime()));
    simCanvas.paint();
    timer.fireAfter();
};
timer.setCallBack(callback);
clock.resume();
timer.startFiring();

A script can be provided in the query portion of the URL (after the question mark) for this page. For example, the following URL contains the above script.

http://www.myphysicslab.com//develop/build/sims/experimental/BlankSlateApp_en.html?var r=PointMass.makeSquare(4);
var dr=new DisplayShape(r);displayList.add(dr);dr.strokeStyle='red';r.setPosition(new Vector(0,0));
var clock=new Clock();var timer=new Timer();
timer.setCallBack(function(){r.setAngle(Math.sin(clock.getTime()));simCanvas.paint();timer.fireAfter();});
clock.resume();timer.startFiring();

Does not work under advanced-compile.

Valid HTML 4.01