HTML Knob Control / JavaScript Knob UI Component
Posted by Nidin Vinayak in HTML+JS, WebDevelopment on May 27, 2013
Hi All, This is an experiment in HTML + JavaScript here i created a rotating knob UI Component with PNG image this is very light weight. An Action Script version is also available Tested browsers : FF, Chrome, Opera, IE9 and Safari. may not work in other browsers at this time however i will add all [...]
Free AS3 Date Range Picker component v 1
Posted by Nidin Vinayak in ActionScript 3, FLASH on May 9, 2013
Hi All, Here is the new variant of as3 date picker. the new open source as3 date range picker This movie requires Flash Player 11.3 Download SWC : Download Demo : Source code : https://github.com/nidin/as3-date-range-picker
3D Flip Book Planning and Feature
Posted by Nidin Vinayak in ActionScript 3, FLASH, Stage3D on February 13, 2013
Hi Folks, I am planning to build a 3D version of flipbook if anybody have any suggestion and feature list please share with me. you can comment on this post. Primary Goals Away3D Flip book engine
Dynamic mesh modification experiment
Posted by Nidin Vinayak in ActionScript 3, FLASH, Stage3D on February 12, 2013
Hi Folks, I am working on Dynamic mesh modification with away3d. My aim is to modify mesh while an object is colliding with another object Experiment Demo http://game.infogroupindia.com/away3d/d2/
Bitmap Drawing Pad
Posted by Nidin Vinayak in ActionScript 3, FLASH on January 10, 2013
Hi Folks, Here is a class to draw patterns in bitmap
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
package nid.tools { import flash.display.BitmapData; import flash.display.Bitmap; import flash.display.Shape; import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.utils.ByteArray; import flash.utils.Endian; /** * ... * @author Nidin Vinayakan */ public class Pencil { private var canvas:Bitmap; private var drawRect:Rectangle; private var pattern:ByteArray; private var _old_x:Number; private var _old_y:Number; private var continued:Boolean; private var shape:Sprite; private var patternBitmapData:BitmapData; public var color:uint = 0xffff0000; public var alpha:Number = 1; public var thickness:Number = 10; public function Pencil() { shape = new Sprite(); buildPattern(); } public function setBrushSize(value:int):void { thickness = value; buildPattern(); } public function setBrushColor(value:uint):void { color = value; buildPattern(); } private function buildPattern():void { shape.graphics.clear(); shape.graphics.beginFill(color, alpha); shape.graphics.drawCircle(thickness/2, thickness/2, thickness/2); shape.graphics.endFill(); pattern = null; patternBitmapData = new BitmapData(thickness, thickness, true, 0x00000000); patternBitmapData.draw(shape, null, null, null, null, true); drawRect = new Rectangle(0, 0, thickness, thickness); pattern = patternBitmapData.getPixels(drawRect); patternBitmapData.dispose(); } public function activate(canvas:Bitmap):void { this.canvas = canvas; canvas.stage.addEventListener(MouseEvent.MOUSE_DOWN, handle); canvas.stage.addEventListener(MouseEvent.MOUSE_UP, handle); } private function handle(e:MouseEvent):void { if (e.type == MouseEvent.MOUSE_DOWN) { pattern.position = 0; canvas.stage.addEventListener(Event.ENTER_FRAME, drawHandle); }else if (e.type == MouseEvent.MOUSE_UP) { canvas.stage.removeEventListener(Event.ENTER_FRAME, drawHandle); continued = false; } } private function setPixels(_x:Number, _y:Number, _w:Number, _h:Number):void { var rect:Rectangle = new Rectangle(_x, _y, _w, _h); var p1:ByteArray = canvas.bitmapData.getPixels(rect); p1.position = 0; pattern.position = 0; for (var i:int = 0; i < p1.length / 4; i++) { var a1:uint = p1.readUnsignedByte(); var r1:uint = p1.readUnsignedByte(); var g1:uint = p1.readUnsignedByte(); var b1:uint = p1.readUnsignedByte(); var a2:uint = pattern.readUnsignedByte(); var r2:uint = pattern.readUnsignedByte(); var g2:uint = pattern.readUnsignedByte(); var b2:uint = pattern.readUnsignedByte(); var a3:uint = (color >> 24) & 0xff var r3:uint = (color >> 16) & 0xff var g3:uint = (color >> 8) & 0xff var b3:uint = color & 0xff p1.position = i * 4; //pattern.position = i * 4; if (a1 != a2) { //trace(a1, r1, g1, b1, '|', a2, r2, g2, b2, '|', a3, r3, g3, b3); p1.writeByte(a1 < a2?a2:a1); p1.writeByte(r3); p1.writeByte(g3); p1.writeByte(b3); }else { p1.writeByte(a2); p1.writeByte(r2); p1.writeByte(g2); p1.writeByte(b2); } } p1.position = 0; canvas.bitmapData.setPixels(rect, p1); } private function drawHandle(e:Event):void { pattern.position = 0; var deltaX:Number = _old_x - canvas.mouseX; var deltaY:Number = _old_y - canvas.mouseY; deltaX = Math.sqrt(deltaX * deltaX); deltaY = Math.sqrt(deltaY * deltaY); if (continued && (deltaX > 2 || deltaY > 2)) { draw(_old_x, _old_y, canvas.mouseX, canvas.mouseY); }else{ setPixels(canvas.mouseX, canvas.mouseY, thickness, thickness); continued = true; } _old_x = canvas.mouseX; _old_y = canvas.mouseY; } private function draw(old_x:Number, old_y:Number, mx:Number, my:Number):void { var dx:Number = mx - old_x; var dy:Number = my - old_y; var udx:Number = Math.sqrt(dx * dx); var udy:Number = Math.sqrt(dy * dy); var c:int = Math.round(udx > udy?dx:dy); var nx:Number; var ny:Number; var Xsign:int = SGN(dx); var Ysign:int = SGN(dy); c = Math.sqrt(c * c); for (var i:int = 0; i < c; i) { i += 2; nx = (dx * (i / c)); ny = (dy * (i / c)); setPixels(old_x + nx, old_y + ny, thickness, thickness); } } public function clear():void { if (canvas != null) { canvas.stage.removeEventListener(Event.ENTER_FRAME, drawHandle); canvas.stage.removeEventListener(MouseEvent.MOUSE_DOWN, handle); canvas.stage.removeEventListener(MouseEvent.MOUSE_UP, handle); } } [Inline] public function SGN(value:Number):int { return value == 0?0:(value < 0 ? -1 : 1); } } } |
AS3 PNG/JPEG(JPG) Encoder with Pixel density (DPI)
Posted by Nidin Vinayak in ActionScript 3, FLASH on September 14, 2012
Hi, Here is my AS3 PNG and JPEG(JPG) Encoder with Pixel density (DPI) This image processing library helps to encode BitmapData in to PNG and JPEG images with Pixel density (DPI). the resultant image will not re-sample usage
|
1 2 |
var bmp_data:BitmapData = new BitmapData(500, 500, false, 0xff0000); var png:ByteArray = PNGEncoder.encode(bmp_data, 150);//150 is pixel density in inches (dpi) |
|
1 2 |
var jpgEncoder:JPEGEncoder = new JPEGEncoder() var jpg:ByteArray = jpgEncoder.encode(bitmap.bitmapData, 300); |
Download : Source code : https://github.com/nidin/as3-image-library
Alternativa3D Experiment – 2 (Skin,Skeleton and Animation)
Posted by Nidin Vinayak in ActionScript 3, FLASH, Stage3D on September 14, 2012
Hi An experiment done with alternativa3d this experiment using following features of alternativa3d Skin Skeleton Animation link :- http://game.infogroupindia.com/a3d/exp2 This movie requires Flash Player 11.3
Alternativa3D Experiment – 1 (Skin,Skeleton and Animation)
Posted by Nidin Vinayak in ActionScript 3, FLASH, Stage3D on September 13, 2012
Hi An experiment done with alternativa3d this experiment using following features of alternativa3d Skin Skeleton Animation link :- http://game.infogroupindia.com/a3d/ This movie requires Flash Player 11.3
War Team Stage3D Game
Posted by Nidin Vinayak in ActionScript 3, Stage3D on August 16, 2012
Hi All, This is my experimental game build with Stage3D DEMO : http://game.infogroupindia.com/
Free AS3 Date chooser/Date Picker Component v4.4.10 revision 1
Posted by Nidin Vinayak in ActionScript 3, FLASH on March 12, 2012
CURRENT VERSION 4.4.10 revision 1 V5 UNDER CONSTRUCTION Hi all, New Version of AS3 Date Picker Released. This movie requires Flash Player 11.3 you can customize lot more things in it, Import Date Chooser class and event class
|
1 2 |
import nid.ui.controls.DatePicker; import nid.events.CalendarEvent; |
Customize calendar icon dynamically.
|
1 2 |
[Embed(source = "../asset/20x20_light_blue.png")] private var icon:Class; |
Dynamic Date Chooser construction
|
1 |
var datePicker:DatePicker = new DatePicker(); |
Set calendar icon
|
1 |
datePicker.icon = new icon(); |
Set Week [...]
