|
-
How to resize item as it goes backward in carousel?!
So my issue is that I want my images to get smaller as they go to the back, and unlike the carousel in the tutorial, I don't want them to go up on the Y axis— I'd like them to stay level horizontally but get smaller as they recede. The code in the tutorial I'm using only goes over how to do this by adjusting radiusY.
If someone could help me out with a snippet of code for this! My current code is:
var numOfItems:Number = 4;
var radiusX:Number = 250;
var radiusY:Number = 5;
var centerX:Number = Stage.width / 2;
var centerY:Number = Stage.height / 2;
var speed:Number = 0.05;
for(var i=0;i<numOfItems;i++)
{
var t = this.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
}
function mover()
{
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;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/5500;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|