Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var window = canvas.Window.new([256, 512], "dialog");
- var mcanvas = window.createCanvas();
- var root = mcanvas.createGroup();
- var grp = root.createChild("group");
- mcanvas.setColorBackground(1, 1, 1, 1);
- var path = grp.createChild("path")
- .setColor(0, 0, 0)
- .setStrokeLineWidth(3)
- .show();
- var grpMove = grp.createChild("group")
- .setTranslation(128, 384);
- var grpPath = grpMove.createChild("path")
- .setColor(0, 0, 0)
- .setStrokeLineWidth(3)
- .moveTo(0, 50)
- .lineTo(0, -50)
- .show();
- var update = func() {
- var time = getprop("sim/time/mp-clock-sec")*2 or 0;
- path.reset()
- .moveTo(128 + math.sin(time) * 50, 128 + math.cos(time) * 50)
- .lineTo(128 + math.sin(time + 3.1415) * 50, 128 + math.cos(time + 3.1415) * 50);
- grpMove.setRotation(-time);
- settimer(func update(), 0.03);
- }
- update();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement