Turtle Graphics: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 77: | Line 77: | ||
} | } | ||
turtleObj.prototype. | turtleObj.prototype.clean = function() { | ||
for(var el in this.board.objects) { | for(var el in this.board.objects) { | ||
this.board.removeObject(el); | this.board.removeObject(el); | ||
} | } | ||
this.init(); | this.init(); | ||
} | |||
turtleObj.prototype.setPos = function(x,y) { | |||
this.pos = [x,y]; | |||
this.turtle.setPositionDirectly(JXG.COORDS_BY_USER,x,y); | |||
this.turtle2.setPositionDirectly(JXG.COORDS_BY_USER,x,y+20); | |||
var t = this.board.createElement('transform', [-this.dir*Math.PI/180.0,this.turtle], {type:'rotate'}); | |||
t.applyOnce(this.turtle2); | |||
var p = this.board.createElement('point',this.pos,{fixed:true,name:' ',visible:false}); | |||
this.points.push(p); | |||
this.board.update(); | |||
} | } | ||
Revision as of 15:53, 19 December 2008