JSX Trigonometrische Funktionen

Aus Wiki1

(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
Zeile 2: Zeile 2:
-
<JSXgraph width="600" height="600" box="box">
+
<jsxgraph box="box" width="400" height="400">
-
var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-5, 10, 7, -5], axis:true});
+
var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-1.33, 1.33, 1.33, -1.33], axis: true});
-
var p = [];
+
board.suspendUpdate();
-
p[0] = board.create('point', [-1,2], {size: 4, face: 'o'});
+
var b1c1 = board.create('circle', [[0,0], [1,0]]);
-
p[1] = board.create('point', [0,-1], {size: 4, face: 'o'});
+
var b1p1 = board.create('point', [2, 0], {slideObject: b1c1});
-
p[2] = board.create('point', [1,0], {size: 4, face: 'o'});
+
var perp = board.create('perpendicular', [board.defaultAxes.x,b1p1],[{strokeColor: '#ff0000', visible: true}, {visible: false}]);
-
p[3] = board.create('point', [2,1], {size: 4, face: 'o'});
+
var perp2 = board.create('perpendicular',[board.defaultAxes.y,b1p1],[{strokeColor: '#0000ff', visible: true}, {visible: false}]);
-
+
board.unsuspendUpdate();
-
var c = board.create('spline', p, {strokeWidth:3});
+
 
-
+
// Animation
-
var g = board.create('glider', [1.5,0,c], {name:'',style:8});
+
var animated = false;
-
var t = board.create('tangent', [g], {dash:2,strokeColor:'#aa0000'});
+
function animate(point, direction, count) {
-
+
     if(animated) {
-
function addPoint() {
+
        point.stopAnimation();
-
     p.push(board.create('point',[(Math.random()-0.5)*10,(Math.random()-0.5)*3],{size: 4, face: 'o'}));
+
        animated = false;
-
     board.update();
+
    } else {
 +
        point.startAnimation(direction, count);
 +
        animated = true;
 +
     }
}
}
-
 
+
</jsxgraph>
-
 
+
-
</JSXgraph>
+
[[Kategorie:Bilder]]
[[Kategorie:Bilder]]
[[Kategorie:Wissen]]
[[Kategorie:Wissen]]

Version vom 17:48, 22. Nov. 2013

Mit Hilfe des Programmpakets JSXGraph (siehe http://jsxgraph.uni-bayreuth.de/wp/) können komplexe, interaktive Grafiken nur mit Hilfe von JavaScript in Webseiten integriert werden. Hier ein Beispiel zur Darstellung der Trigonometrischen Funktionen (der rote Punkt kann mit der Maus bewegt werden!):


Persönliche Werkzeuge