RE: [Flashcoders] Changing angle for better arrangement in circle
I think you might want to look into Papervision3D to get exactly what you want. If not, your math logic is going to have to be crazy to get the results you are wanting. Your spacing stays the same because you are working on a 2D scale. If you use papervision, you might have better luck achieving your goal. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, April 21, 2010 11:16 PM To: Flash Coders List Subject: Re: [Flashcoders] Changing angle for better arrangement in circle Red dots I put to show points where items are attached. As you see space between points are equal. Some items are scaled and space between them is not equal. That what I try to change. Space should be equal between each item. 2010/4/21 Nathan Mynarcik nat...@mynarcik.com: If you want the dots to be on top of all the items, the dots need to be in separate MCs of the items and need to be added to the stage after all the other item MCs have been added. Quoting natalia Vikhtinskaya natavi.m...@gmail.com: Here is a result http://www.mightybook.com/test/test.html I want they don't overlap each other. Is that possible? 2010/4/22 Matt S. mattsp...@gmail.com: If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I dont understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
Hi, aside from the fact that the illusion of perspective depends on the items being scaled and the spacing not being equal, i see two options, a) limit the maximum scale, dirty but might be a quick trick. Either by multiplying it by some root or a hard limit. b) sum the (scaled) width of all items, walk through list again and keep track of the (scaled) width of the items traversed up to that point. For the current item base it's angle on (in pseudo) currentListWidthUpToThisPoint/totalwidth. When determining the width of the list you can add a padding between each item, which allows you to play which the separation and scale. Just an idea I haven't tried this out, that's why the (scaled) is between brackets, you'll have to experiment with what works best. regards JC On Thu, Apr 22, 2010 at 8:29 AM, Nathan Mynarcik nat...@mynarcik.comwrote: I think you might want to look into Papervision3D to get exactly what you want. If not, your math logic is going to have to be crazy to get the results you are wanting. Your spacing stays the same because you are working on a 2D scale. If you use papervision, you might have better luck achieving your goal. -Original Message- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of natalia Vikhtinskaya Sent: Wednesday, April 21, 2010 11:16 PM To: Flash Coders List Subject: Re: [Flashcoders] Changing angle for better arrangement in circle Red dots I put to show points where items are attached. As you see space between points are equal. Some items are scaled and space between them is not equal. That what I try to change. Space should be equal between each item. 2010/4/21 Nathan Mynarcik nat...@mynarcik.com: If you want the dots to be on top of all the items, the dots need to be in separate MCs of the items and need to be added to the stage after all the other item MCs have been added. Quoting natalia Vikhtinskaya natavi.m...@gmail.com: Here is a result http://www.mightybook.com/test/test.html I want they don't overlap each other. Is that possible? 2010/4/22 Matt S. mattsp...@gmail.com: If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I don’t understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
Perhaps this formula will help: function applyPerspective(pMC:MovieClip, x:Number, y:Number):Void { var centerX:Number = 200; // center of 2D-scene (X) var centerY:Number = 200; // center of 2D-scene (Y) var distCenter:Number = 60; // distance of the perspective plan to the center of 3D world var lensFocal:Number = 200; // perspective focal var cameraAngle:Number = -45; // x-angle of camera // 3D coordinates cameraAngle *= Math.PI/180; // convert to radians var z:Number = distCenter + y * Math.sin(cameraAngle); y *= Math.cos(cameraAngle); var s:Number = lensFocal/ ( lensFocal + z); // ratio // 2D coordinates render: pMC._x = centerX + s * x; pMC._y = centerY + s * y; pMC._xscale = pMC._yscale = s * 100; // TODO: ajust scale pMC.swapDepths(int(2000 + 1000*pMC._y + pMC._x)); // a simple z-sort formula } usage (in your case): applyPerspective(mc, radius*Math.cos(mc.angle), radius*Math.sin(mc.angle)); You will probably have to try-and-guess by adjusting initial setup variables. You can achieve nice 3D effect by connecting some property (example: cameraAngle) with _ymouse. -- Olivier Besson (gludion) - (33 1) 44 64 78 99 http://www.gludion.com http://blog.gludion.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
Thank you so much!!! I will try this. 2010/4/22 Olivier Besson ol...@gludion.com: Perhaps this formula will help: function applyPerspective(pMC:MovieClip, x:Number, y:Number):Void { var centerX:Number = 200; // center of 2D-scene (X) var centerY:Number = 200; // center of 2D-scene (Y) var distCenter:Number = 60; // distance of the perspective plan to the center of 3D world var lensFocal:Number = 200; // perspective focal var cameraAngle:Number = -45; // x-angle of camera // 3D coordinates cameraAngle *= Math.PI/180; // convert to radians var z:Number = distCenter + y * Math.sin(cameraAngle); y *= Math.cos(cameraAngle); var s:Number = lensFocal/ ( lensFocal + z); // ratio // 2D coordinates render: pMC._x = centerX + s * x; pMC._y = centerY + s * y; pMC._xscale = pMC._yscale = s * 100; // TODO: ajust scale pMC.swapDepths(int(2000 + 1000*pMC._y + pMC._x)); // a simple z-sort formula } usage (in your case): applyPerspective(mc, radius*Math.cos(mc.angle), radius*Math.sin(mc.angle)); You will probably have to try-and-guess by adjusting initial setup variables. You can achieve nice 3D effect by connecting some property (example: cameraAngle) with _ymouse. -- Olivier Besson (gludion) - (33 1) 44 64 78 99 http://www.gludion.com http://blog.gludion.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I don’t understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
Here is a result http://www.mightybook.com/test/test.html I want they don't overlap each other. Is that possible? 2010/4/22 Matt S. mattsp...@gmail.com: If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I don’t understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
If you want the dots to be on top of all the items, the dots need to be in separate MCs of the items and need to be added to the stage after all the other item MCs have been added. Quoting natalia Vikhtinskaya natavi.m...@gmail.com: Here is a result http://www.mightybook.com/test/test.html I want they don't overlap each other. Is that possible? 2010/4/22 Matt S. mattsp...@gmail.com: If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I don’t understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Changing angle for better arrangement in circle
Red dots I put to show points where items are attached. As you see space between points are equal. Some items are scaled and space between them is not equal. That what I try to change. Space should be equal between each item. 2010/4/21 Nathan Mynarcik nat...@mynarcik.com: If you want the dots to be on top of all the items, the dots need to be in separate MCs of the items and need to be added to the stage after all the other item MCs have been added. Quoting natalia Vikhtinskaya natavi.m...@gmail.com: Here is a result http://www.mightybook.com/test/test.html I want they don't overlap each other. Is that possible? 2010/4/22 Matt S. mattsp...@gmail.com: If the objects you were placing were centered rather than positioned at 0/0, you could scale them and they would automatically be properly distanced. There might be other reasons why you cant center them of course but that would be the quick fix... .m On Wed, Apr 21, 2010 at 4:16 PM, natalia Vikhtinskaya natavi.m...@gmail.com wrote: Another question about better arrangement in circle. If I place items in circle and scale them like this this._x = Math.cos(this.angle) * radiusX + centerX; this._y = Math.sin(this.angle) * radiusY + centerY; var s = (this._y ) /(centerY+radiusY); this._xscale = this._yscale = s*100; Is it possible to have equal distance between items? I should change angle depending on real scale that they have but I don’t understand how to do that. Thank you if anybody can explain this mathematics. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders