Jump to content
Search Community

Correct x,y,z,rot, etc.

wiresimon test
Moderator Tag

Recommended Posts

Hi green ppl!

I have a question concerning a problem occuring when tweening stuff while trying to calculate things with values that are ought to be present after tweening...

 

Ok, here it goes.

I am working on a project that is about grids. and sliders and lists and linked lists and yea... it sounds easy but it's really not =)

See, I have a huge grid of items and whenever I remove an item somewhere inside that list, I have to update the whole grid without rebuilding it from scratch. Reason behind that is simple, animations are ought to occure, for example, if one item gets removed, all other items have to shift one item-position.

Now, when not tweening but simply setting the coords, everything works just fine but once i start tweening, everything blows appart. for instance, the currentList.width is not accurate at the point in time a new item is added, since another item is still moving. To overcome this, I figured to store all final values appart from each items position and then tween to the final value. Sounds good enough, but since my little framework has grown and grown and scrollers extends lists and grids extends list that again can hold scrollers as child-items, etc... - everything is growing over my head.

Is there a way to tell TweenMax/Lite to animate stuff while not really touching the x,y,z, etc properties? I know this sounds stupid but since threading is not an option in as3, maybe someone has struggled at this before and has an idea of how to overcome this?

 

regards,

wiresimon

 

 

:: edit: appart from the obvious onComplete, which would slow down the whole appliction when 100 items are being animated in ::

Link to comment
Share on other sites

Hi,

 

Would love to help but I'm having difficulty understanding a significant portion of your explanation.

All I can really understand is that you are having trouble finding the right values to pass into your tweens due to the complex nature of your framework and the fact that the width of a currentList apparently is changing.

 

To overcome this, I figured to store all final values appart from each items position and then tween to the final value

 

as I understand it, that seems to be exactly the advice I would give you.

 

Is there a way to tell TweenMax/Lite to animate stuff while not really touching the x,y,z, etc properties

TweenMax directly changes the properties you specify in your tweens. There is no way of moving an item to the left without changing it's x value.

 

Perhaps if you can create a file that demonstrates the issue in the simplest way possible, a clear solution will appear. Right now its just tough to imagine what is happening and how to fixe it.

 

c

Link to comment
Share on other sites

Hey there, thanks for the reply. I think you got me just right. However, I can create an example as soon as I get home. However, the sollution i came up with - the sollution you'd suggest me aswell - seems to be the only way to go. The source complexity grows with it and I just have to keep my head clear so I dont run into more and more errors during implementation.

 

Regards,

simon

Link to comment
Share on other sites

Sry I didn't send any files whatsoever, was just way too busy and had to focus on other stuff. However, I have to bump this one up top to solve my problems from the ground up, instead of rewriting 10 or more classes.

 

So, as already stated, it is key for me to store all 'real values' appart from the x,y,z values.

So I came up with an idea, which looks like this:

 

override public function set x(value:Number):void
{
dx = value;
update();
}

private function update():void
{
 super.x = dx
}

Instead of calling super.in the update function, I want to start tweening there. Here's the problem:

Neither

TweenLite.to(super, 0.3, {x:dx})

nor

TweenLite.to(this, 0.3, {super.x:dx})

works.

 

So my question nails down to this: How to call super properties the green way?

 

Regards,

Simon

Link to comment
Share on other sites

:: edit:

I already tried to simply tween a variable in the current class, doing sth like this:

 

public class MyClass
{
  private var tweenVar:Number;
   override public function set x(value:Number){...}
 private function update():void
 {
	  TweenLite.to(this, 0.3, {tweenVar, onUpdate: updateHandler})
	   ....
  private function updateHandler():void
  {
	   super.x = tweenVar;
  }
...

Doesn't work

Link to comment
Share on other sites

:: edit:

I already tried to simply tween a variable in the current class, doing sth like this:

 

public class MyClass
{
  private var tweenVar:Number;
override public function set x(value:Number){...}
 private function update():void
 {
	  TweenLite.to(this, 0.3, {tweenVar, onUpdate: updateHandler})
	   ....
  private function updateHandler():void
  {
	   super.x = tweenVar;
  }
...

Doesn't work

 

EHM, sry. I must be stoned. The described above works just fine.

Sry and have a nice day

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...