Difference between revisions of "Texts and Transformations II"
From JSXGraph Wiki
Jump to navigationJump to searchA WASSERMANN (talk | contribs) |
A WASSERMANN (talk | contribs) |
||
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 09: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.