Texts and Transformations II: Difference between revisions
From JSXGraph Wiki
A WASSERMANN (talk | contribs) No edit summary |
A WASSERMANN (talk | contribs) No edit summary |
||
Line 7: | Line 7: | ||
JXG.Options.text.display = 'internal'; | JXG.Options.text.display = 'internal'; | ||
brd = JXG.JSXGraph.initBoard('box2', {boundingbox:[-5, | brd = JXG.JSXGraph.initBoard('box2', {boundingbox:[-5,20,5,-20], axis:true, showNavigation:true, showCopyright:true}); | ||
p0 = brd.create('point', [0,0], {style:5, name:'offset'}); | p0 = brd.create('point', [0,0], {style:5, name:'offset'}); | ||
p1 = brd.create('point', [3,0], {style:5, name:'rotate+scale'}); | p1 = brd.create('point', [3,0], {style:5, name:'rotate+scale'}); | ||
txt = brd.create('text',[0,0, 'Hello World'], {fontSize:30}); | txt = brd.create('text',[0,0, 'Hello World'], {fontSize:30}); | ||
im = brd.create('image',["/distrib/images/uccellino.jpg", [0,0], [3, | im = brd.create('image',["/distrib/images/uccellino.jpg", [0,0], [3,3]], {opacity:0.5}); | ||
var tOff = brd.create('transform', [function(){return p0.X()},function(){return p0.Y()}], {type:'translate'}); | var tOff = brd.create('transform', [function(){return p0.X()},function(){return p0.Y()}], {type:'translate'}); |
Revision as of 07:22, 1 August 2011
This example is similar to the one Text and Transformations, beside that the x-axis and the y-axis have different scalings. To be precise, tha ratio of the two scalings is equal to 4. The result is that rotating the text and the image will also stretch these objects.
In order to avoid this effect, we have to do the following
The JavaScript code
Here is the complete code to accomplish this behaviour.