Raphael: Inherited transformations -
based on thread (raphaeljs transformations sets) have played around inherited transformations using sets in sets.
i tried put set in set , each set apply 45° rotation. expected, both rotation sum 90° rotation. working fine.
but both rotations relative centerpoint of each single object in set. how can achieve, rotations relative center point of set? possible?
to clarify mean. if have 2 rectangles in set , apply rotation on set, want rectangles stay in same position , angle relative them self, because both rotate around axis between them, in middle of set. must translated additionally rotation...
how can achieve this?
jsfiddle:http://jsfiddle.net/bby9b/
var paper = raphael(0,0,500,500); var = paper.rect(10,10,50,10); var b = paper.rect(10,30,50,10) var c = paper.rect(10,50,50,10); var d = paper.rect(10,70,50,10); var set = paper.set() set.push(a); set.transform("r-45"); var rootset = paper.set(); rootset.push(set, b, c); rootset.transform("...r-45");
thx in advance!
the r command takes 2 additional optional parameters centre point of rotation. looks want this:
window.onload = function(){ var paper = raphael(0,0,500,500); var = paper.rect(10,10,50,10); var b = paper.rect(10,30,50,10) var c = paper.rect(10,50,50,10); var d = paper.rect(10,70,50,10); var set = paper.set() set.push(a); set.transform("...r-45,40,45"); var rootset = paper.set(); rootset.push(set, b, c); rootset.transform("...r-45,40,45"); }
Comments
Post a Comment