Place images into different sectors of a circle(Titanium) -
i have image of circle divided n sectors in titanium. inside each sector need place image. each image angle calculated first image pivoted in center.
how can ? place first image pivot in center-top , place others images @ angle distance in other sectors.
you can apply rotation each image.
i've done similar, maybe can you. wanted put label in each sector. this, first have create transparent view cover more or less sector, put sector in place rotating , put label inside sector view.
this code use:
var numberarray = [1, 2, 3, 4, 5, 6, 7, 8]; var angle = 360 / 8; var rotation = 0; (var = 0; < 8; i++) { var sector = ti.ui.createview({ backgroundcolor : 'transparent', width : 25, height : circle.height / 2, top : 0 }); circle.add(sector); rotation = rotation + angle*i; var matrix = ti.ui.create2dmatrix() matrix = matrix.rotate(rotation); var = ti.ui.createanimation({ transform : matrix, duration : 1000, autoreverse : false, repeat : 0 }); a.anchorpoint = { x : 0.5, y : 0.5 } sector.anchorpoint = { x : 0.5, y : 0.5 } sector.animate(a); // create label. var numberlabel = ti.ui.createlabel({ text : numberarray[i], color : '#ff0000', font : { fontsize : 26 }, textalign : 'center', top : 10 }); // add parent view. sector.add(numberlabel); }
Comments
Post a Comment