Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var vertices:Array<Float> = new Array();
- var indices:Array<Int> = new Array();
- var uvt:Array<Float> = new Array();
- var bitmap:flash.display.Shape;
- var image:flash.display.BitmapData=cast(getImageForActor(__theActor), BitmapData);
- bitmap = new flash.display.Shape();
- var width=Std.int(image.width);
- var height=Std.int(image.height);
- vertices = [0,0, width,0, 0,height,width,height] ;
- indices = [0, 1, 2, 1, 3, 2];
- uvt = [0,0,1, 1,0,1, 0,1,1, 1,1,1];
- var struct = { a:0, b:width};
- Actuate.tween(struct, __theDuration, { a:width/2, b:width/2 } ).onUpdate(function() {
- // we push pixels to top
- if(uvt[5] > 0) uvt[5]=uvt[5]-0.01;else{uvt = [0,0,0, 0,0,0, 0,0,0, 0,0,0]; }
- // top is pushed together
- // struct is tweened from 0,width to width/2,width/2 in 2 seconds
- vertices[0] = struct.a;
- vertices[2] = struct.b;
- bitmap.graphics.clear();
- bitmap.graphics.beginBitmapFill(image);
- bitmap.graphics.drawTriangles(openfl.Vector.ofArray(vertices), openfl.Vector.ofArray(indices), openfl.Vector.ofArray(uvt));
- bitmap.graphics.endFill();
- var bmp=new BitmapData(image.width,image.height);
- bmp.draw(bitmap);
- var bitmapwrapper = new BitmapWrapper(new Bitmap( bmp ));
- attachImageToActor(bitmapwrapper, __theActor, 0,0, 1); // 1 = front
- } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement