Jump to content
Search Community

Tween a rectangle Shape

burn test
Moderator Tag

Recommended Posts

sorry, but there isn't a singular actionscript or TweenLite command that is going to do that for you.

 

one way of doing it is to use the drawing api to constantly redraw a new rectangle with new point values for each corner.

 

the following code will move 1 corner:

 

 

import flash.display.Shape;
import com.greensock.*;
import com.greensock.easing.*;
var xVal:Number = 100;
var yVal:Number = 0;

TweenLite.to(this, 2, {xVal:200, yVal:-100, ease:Back.easeOut, onUpdate:drawRect, delay:.8})

var shape:Shape = new Shape();
addChild(shape);

shape.x = 100;
shape.y = 200;


function drawRect():void{
shape.graphics.clear();
shape.graphics.lineStyle(1, 0xff0000, 1, false, "none");
shape.graphics.lineTo(xVal, yVal);
shape.graphics.lineTo(100, 100);
shape.graphics.lineTo(0, 100);
shape.graphics.lineTo(0,0);
}

drawRect();

 

you can paste that into any fla that has access to TweenLite.

 

another option would be to google Flash TransformMatrix Skew and see if you come across anything that does exactly what you need. Not so sure how to go about it myself.

you can also mess around with the TransformMatrix greensock plugin on http://www.greensock.com/tweenmax/ and see if it does something close to what you need.

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...