# Trying to merge 3d with a tween engine, need assistance

**URL:** <https://forum.kirupa.com/t/trying-to-merge-3d-with-a-tween-engine-need-assistance/243228>\
**Category:** flash\
**Created:** [November 4, 2007, 7:01pm UTC](https://forum.kirupa.com/t/trying-to-merge-3d-with-a-tween-engine-need-assistance/243228 "2007-11-04T19:01:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tripdragon](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@tripdragon](https://forum.kirupa.com/u/tripdragon)\
**Post date:** [November 4, 2007, 7:01pm UTC](https://forum.kirupa.com/t/trying-to-merge-3d-with-a-tween-engine-need-assistance/243228/1 "2007-11-04T19:01:24Z")

</div>

I am trying to use Twease engine to edit stuff in fake 3d per Keith Peters book Actionscript Animation with this code below.

I want to do to things, have it meld with the fake 3d scaling, and be able to feed it the \_z value. So far I am unsuccessful in my grasp of lower level AS2

Pleeaase help :D,

Twease site  
[http://play.visualcondition.com/twease/](http://play.visualcondition.com/twease/)

```auto
import com.visualcondition.twease.*;

var numBalls:Number = 1;
var x:Number = 0;
var y:Number = 0;
var z:Number = -240;
var fl:Number = 250;
var vpX:Number = Stage.width / 2;
var vpY:Number = Stage.height / 2;

init();

function init() {

	for (var i:Number = 0; i<numBalls; i++) {
		var ball:MovieClip = attachMovie("ball", "ball" + i, i);
		ball.x = 0;
		ball.y = 0;
		ball.z = 100;
		
	}
	
}
function onEnterFrame():Void
{

	for (var i:Number=0;i<numBalls;i++) {
		var ball:MovieClip = this["ball" + i];

	//x = _xmouse - vpX;
	//y = _ymouse - vpY;
	if(Key.isDown(Key.UP))
	{
		ball.z+=5;
	}
	else if(Key.isDown(Key.DOWN))
	{
		ball.z-=5;
	}
	if(z <= -fl)
	{
		ball._visible = false;
	}
	else
	{
		ball._visible = true;
		var scale:Number = fl / (fl + ball.z);
		ball._xscale = ball._yscale = scale * 100;

		ball._x = vpX + x * scale;
		ball._y = vpY + y * scale;
		
	}

	}
}
					Twease.tween({target:ball, _y:900, time:2});

```
