BetweenAS3 Transition cheat sheet(大きくしてみる場合はここをクリック)
BetweenAS3 Transition cheat sheet – wonderfl build flash online
Tweenerのeasingと同じものが揃っている。名前もほとんど同じでTweenerでは「transition:”easeOutExpo”」という書き方をするが、BetweenAS3では「Expo.easeOut」となる。移行しやすい。easingのデファクトスタンダードがあるのかも。ちなみにeasingのデフォルト値はLinear.linear
▼元ネタ
Tweener Transition cheat sheet
http://www.tonpoo.com/tweener/misc/transitions.html
▼ActionScript AS3(FP9)
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
/* BetweenAS3 Transition cheat sheet Tweenerのやつのパクリ版。 FULL SCREENにすると広く見えるよ。 ちなみにeasingのデフォルト値は Linear.linear ★参考 Tweener Transition cheat sheet http://www.tonpoo.com/tweener/misc/transitions.html */ package { import flash.display.Sprite; import flash.display.SimpleButton; import flash.events.MouseEvent; import flash.geom.Rectangle; import flash.printing.PrintJob; import flash.text.TextField; import org.libspark.betweenas3.BetweenAS3; import org.libspark.betweenas3.tweens.ITween; import org.libspark.betweenas3.easing.*; import org.libspark.betweenas3.core.easing.IEasing; public class Main extends Sprite { private var _cellRect:Rectangle = new Rectangle(0,0,155,110); private var _tableType:String = "Medium"; public function Main() { stage.align = "TL"; stage.scaleMode = "noScale"; stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); BetweenAS3.delay(BetweenAS3.func(mouseUpHandler,[null]),0.5).play(); addBtn(3,0,"Simple"); addBtn(66,0,"Medium"); addBtn(129,0,"Complete"); addBtn(402,0,"Print"); } private function mouseUpHandler(e:MouseEvent):void { if(e){ if(e.target is TextField){ return; } } while (numChildren > 4) { removeChildAt(4); } var stageWidth:int = stage.stageWidth; var stageHeight:int = stage.stageHeight; if(e){ if(e.target.name == "Simple" || e.target.name == "Medium" || e.target.name == "Complete"){ _tableType = e.target.name; }else if(e.target.name == "Print"){ if(stageWidth < stageHeight){ stageWidth = 550; stageHeight = 800; }else{ stageWidth = 790; stageHeight = 550; } BetweenAS3.delay(BetweenAS3.func(setPrint, [stageWidth, stageHeight]), 4).play(); } } var partitionX:int = 3; var partitionY:int = 5; if(_tableType == "Simple"){ partitionX = 2; }else if(_tableType == "Complete"){ partitionX = 4; } var h:int = 20; var dW:int = 0; if(stageWidth > 465 || stageHeight > 465){ if(stageWidth > stageHeight){ partitionX *= 2; dW = 5; }else{ partitionY *= 2; } } _cellRect.width = Math.floor((stageWidth-dW)/partitionX); _cellRect.height = Math.floor((stageHeight-h)/partitionY); addCell(0,h,Sine.easeIn,"Sine.easeIn"); addCell(0,_cellRect.height+h,Cubic.easeIn,"Cubic.easeIn"); addCell(0,_cellRect.height*2+h,Quint.easeIn,"Quint.easeIn"); addCell(0,_cellRect.height*3+h,Circ.easeIn,"Circ.easeIn"); addCell(0,_cellRect.height*4+h,Back.easeIn,"Back.easeIn"); addCell(_cellRect.width,h,Sine.easeOut,"Sine.easeOut"); addCell(_cellRect.width,_cellRect.height+h,Cubic.easeOut,"Cubic.easeOut"); addCell(_cellRect.width,_cellRect.height*2+h,Quint.easeOut,"Quint.easeOut"); addCell(_cellRect.width,_cellRect.height*3+h,Circ.easeOut,"Circ.easeOut"); addCell(_cellRect.width,_cellRect.height*4+h,Back.easeOut,"Back.easeOut"); if(_tableType == "Medium" || _tableType == "Complete"){ addCell(_cellRect.width*2,h,Sine.easeInOut,"Sine.easeInOut"); addCell(_cellRect.width*2,_cellRect.height+h,Cubic.easeInOut,"Cubic.easeInOut"); addCell(_cellRect.width*2,_cellRect.height*2+h,Quint.easeInOut,"Quint.easeInOut"); addCell(_cellRect.width*2,_cellRect.height*3+h,Circ.easeInOut,"Circ.easeInOut"); addCell(_cellRect.width*2,_cellRect.height*4+h,Back.easeInOut,"Back.easeInOut"); } if(_tableType == "Complete"){ addCell(_cellRect.width*3,h,Sine.easeOutIn,"Sine.easeOutIn"); addCell(_cellRect.width*3,_cellRect.height+h,Cubic.easeOutIn,"Cubic.easeOutIn"); addCell(_cellRect.width*3,_cellRect.height*2+h,Quint.easeOutIn,"Quint.easeOutIn"); addCell(_cellRect.width*3,_cellRect.height*3+h,Circ.easeOutIn,"Circ.easeOutIn"); addCell(_cellRect.width*3,_cellRect.height*4+h,Back.easeOutIn,"Back.easeOutIn"); } if(stageWidth > 465 || stageHeight > 465){ var w:int = _cellRect.width*partitionX/2+dW; if(stageWidth < stageHeight){ w = 0; h += _cellRect.height*5; } addCell(w,h,Quad.easeIn,"Quad.easeIn"); addCell(w,_cellRect.height+h,Quart.easeIn,"Quart.easeIn"); addCell(w,_cellRect.height*2+h,Expo.easeIn,"Expo.easeIn"); addCell(w,_cellRect.height*3+h,Elastic.easeIn,"Elastic.easeIn"); addCell(w,_cellRect.height*4+h,Bounce.easeIn,"Bounce.easeIn"); addCell(_cellRect.width+w,h,Quad.easeOut,"Quad.easeOut"); addCell(_cellRect.width+w,_cellRect.height+h,Quart.easeOut,"Quart.easeOut"); addCell(_cellRect.width+w,_cellRect.height*2+h,Expo.easeOut,"Expo.easeOut"); addCell(_cellRect.width+w,_cellRect.height*3+h,Elastic.easeOut,"Elastic.easeOut"); addCell(_cellRect.width+w,_cellRect.height*4+h,Bounce.easeOut,"Bounce.easeOut"); if(_tableType == "Medium" || _tableType == "Complete"){ addCell(_cellRect.width*2+w,h,Quad.easeInOut,"Quad.easeInOut"); addCell(_cellRect.width*2+w,_cellRect.height+h,Quart.easeInOut,"Quart.easeInOut"); addCell(_cellRect.width*2+w,_cellRect.height*2+h,Expo.easeInOut,"Expo.easeInOut"); addCell(_cellRect.width*2+w,_cellRect.height*3+h,Elastic.easeInOut,"Elastic.easeInOut"); addCell(_cellRect.width*2+w,_cellRect.height*4+h,Bounce.easeInOut,"Bounce.easeInOut"); } if(_tableType == "Complete"){ addCell(_cellRect.width*3+w,h,Quad.easeOutIn,"Quad.easeOutIn"); addCell(_cellRect.width*3+w,_cellRect.height+h,Quart.easeOutIn,"Quart.easeOutIn"); addCell(_cellRect.width*3+w,_cellRect.height*2+h,Expo.easeOutIn,"Expo.easeOutIn"); addCell(_cellRect.width*3+w,_cellRect.height*3+h,Elastic.easeOutIn,"Elastic.easeOutIn"); addCell(_cellRect.width*3+w,_cellRect.height*4+h,Bounce.easeOutIn,"Bounce.easeOutIn"); } } } private function addCell(x:Number ,y:Number,easing:IEasing,title:String):void { var c:Cell = new Cell(title,_cellRect); c.x = x; c.y = y; this.addChild(c); var array:Array = []; for (var i:int = 0; i < 75; i++) { array[i] = easing.calculate(i / 74, 0, 1, 1); } c.start(array); } private function setPrint(stageWidth:int,stageHeight:int):void { var pj:PrintJob = new PrintJob(); if (pj.start()) { pj.addPage(this, new Rectangle(0, 20, stageWidth,stageHeight)); } pj.send(); } private function addBtn(x:Number,y:Number,txt:String):void{ var sb:SimpleButton = new SimpleButton(getRoundRect(0xEEEEEE,txt),getRoundRect(0xDDDDDD,txt),getRoundRect(0xFFFFFF,txt),getRoundRect(0xFF0000,txt)); sb.x = x; sb.y = y; sb.name = txt; addChild(sb); } private function getRoundRect(c:int,txt:String):Sprite{ var sp:Sprite = new Sprite(); sp.graphics.beginFill(c); sp.graphics.drawRoundRect(0,0,60,18,2); sp.graphics.endFill(); var tf:TextField = new TextField(); tf.text = txt; tf.autoSize = "left"; tf.x = (60-tf.width)/2; sp.addChild(tf); return sp; } } } import flash.display.Bitmap; import flash.display.BitmapData; import flash.display.Sprite; import flash.events.Event; import flash.geom.Rectangle; import flash.text.TextField; class Cell extends Sprite { private var _bitmapData:BitmapData; private var _bitmap:Bitmap; private var _dotstage:Sprite; private var _dot:Sprite; private var _cellRect:Rectangle;// = new Rectangle(0,0,157,110); private var _coreRect:Rectangle;// = new Rectangle(3,20,150,80); private var _count:int; private var _easing_array:Array; public function Cell(txt:String,_cellRect:Rectangle) { this._cellRect = new Rectangle(); this._coreRect = new Rectangle(); this._cellRect = _cellRect; this._coreRect.x = _cellRect.x+3; this._coreRect.y = _cellRect.y+20; this._coreRect.width = _cellRect.width-7; this._coreRect.height = _cellRect.height-30; setupScreen(); _dotstage = new Sprite(); _dot = new Sprite(); _dot.graphics.beginFill(0xFF); _dot.graphics.drawCircle(0,0,1); _dot.graphics.endFill(); _dot.x = _coreRect.x+1; _dot.y = _coreRect.y+_coreRect.height; _dotstage.addChild(_dot); this.addChild(_dotstage); addNewText(4,4,txt); } private function setupScreen():void { _bitmapData = new BitmapData(_cellRect.width, _cellRect.height, false, 0xFFFFFF); var sp:Sprite = new Sprite(); sp.graphics.lineStyle(1,0x999999); sp.graphics.beginFill(0xDDDDDD); sp.graphics.drawRect(_coreRect.x,_coreRect.y,_coreRect.width,_coreRect.height); sp.graphics.endFill(); sp.graphics.lineStyle(1,0xCCCCCC); sp.graphics.moveTo(_coreRect.x+_coreRect.width/4,_coreRect.y+1); sp.graphics.lineTo(_coreRect.x+_coreRect.width/4,_coreRect.y+_coreRect.height); sp.graphics.moveTo(_coreRect.x+_coreRect.width/2,_coreRect.y+1); sp.graphics.lineTo(_coreRect.x+_coreRect.width/2,_coreRect.y+_coreRect.height); sp.graphics.moveTo(_coreRect.x+_coreRect.width*3/4,_coreRect.y+1); sp.graphics.lineTo(_coreRect.x+_coreRect.width*3/4,_coreRect.y+_coreRect.height); // sp.graphics.moveTo(_coreRect.x+1,_coreRect.y+_coreRect.height/4); sp.graphics.lineTo(_coreRect.x+_coreRect.width,_coreRect.y+_coreRect.height/4); sp.graphics.moveTo(_coreRect.x+1,_coreRect.y+_coreRect.height/2); sp.graphics.lineTo(_coreRect.x+_coreRect.width,_coreRect.y+_coreRect.height/2); sp.graphics.moveTo(_coreRect.x+1,_coreRect.y+_coreRect.height*3/4); sp.graphics.lineTo(_coreRect.x+_coreRect.width,_coreRect.y+_coreRect.height*3/4); _bitmapData.draw(sp); _bitmap = new Bitmap(_bitmapData); this.addChild(_bitmap); } private function bitmapDataDraw():void { var bitmapData:BitmapData = _bitmapData; bitmapData.draw(_dotstage) } public function start(array:Array):void { _easing_array = array; this.addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(e:Event):void { _dot.x = (_coreRect.width - 1) * _count / (_easing_array.length - 1) +_coreRect.x + 1; _dot.y = _coreRect.y + _coreRect.height - _easing_array[_count] * (_coreRect.height - 1); bitmapDataDraw(); _count ++; if (_count >= _easing_array.length) { this.removeEventListener(Event.ENTER_FRAME, onEnterFrame); } } private function addNewText(x:Number, y:Number, txt:String):void { var tf:TextField = new TextField(); tf.text = txt; tf.width = _coreRect.width; tf.height = 19; tf.x = x; tf.y = y; this.addChild(tf); } } |