burn Posted January 11, 2012 Share Posted January 11, 2012 Hey, is it possible to tween the upper left and right corner of an rectangle Shape? My goal is to draw an skew rectangle by tweening up the left and right corner with an easing effect. Kind of bubbling. Link to comment Share on other sites More sharing options...
Carl Posted January 11, 2012 Share Posted January 11, 2012 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now