flash on 2010-3-9 Saqoosha forked:3 favorite:2 lines:45 license : MIT License modified : 2010-03-09 13:07:04 package { import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.CapsStyle; import flash.display.LineScaleMode; import flash.display.Loader; import flash.display.LoaderInfo; import flash.display.Sprite; import flash.display.StageQuality; import flash.events.Event; import flash.geom.Matrix; import flash.net.URLRequest; import flash.system.LoaderContext; public class FlashTest extends Sprite { private var img:BitmapData; public function FlashTest() { var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _onComplete); loader.load(new URLRequest("http://saqoosha.net/lab/wonderfl/saqoosha.jpg"), new LoaderContext(true)); } private function _onComplete(event:Event):void { var loader:Loader = LoaderInfo(event.target).loader; img = Bitmap(loader.content).bitmapData; stage.quality = StageQuality.BEST; var thickness:Number = 30; var x0:Number = 50; var y0:Number = 50; var x1:Number = 350; var y1:Number = 100; var dx:Number = x1 - x0; var dy:Number = y1 - y0; var len:Number = Math.sqrt(dx * dx + dy * dy); var a:Number = Math.atan2(dy, dx); var mtx:Matrix = new Matrix(); mtx.scale(len / img.width, thickness / img.height); mtx.translate(0, -thickness / 2); mtx.rotate(a); mtx.translate(x0, y0); graphics.lineStyle(thickness, 0, 0, false, LineScaleMode.NORMAL, CapsStyle.NONE); graphics.lineBitmapStyle(img, mtx, false, false); graphics.moveTo(x0, y0); graphics.lineTo(x1, y1); } } } Code Fullscreen Preview Fullscreen _azzip clockmaker : graphics lineBitmapStyleを二点間の角度・距離に応じて調整して塗る方法 graphics translate StageQuality.BEST rotate target Matrix Event.COMPLETE Math.atan2 scale Math.sqrt URLRequest Event Number sort new page view favorite forked pv 356 forked from: flash on 2010-3-9.. faunus forked:0 favorite:0 lines:45 ( diff:2 ) pv 868 forked from: flash on 2010-3-9.. sanesashi forked:3 favorite:0 lines:46 ( diff:55 ) pv 0 forked from: flash on 2010-3-9.. publicroots forked:0 favorite:0 lines:45 ( diff:1 )