※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!

wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)

 notice: Flash editor updated! Join the development! Thanks to MiniBuilder


forked from : mash's sandy 3d engine sample [diff(92)]

FORKED
  1. // forked from makc3d's Hello Sandy 3D :)
  2. package  
  3. {
  4.     import flash.display.*;
  5.     import flash.filters.*;
  6.     import flash.geom.*;
  7.     import sandy.core.data.*;
  8.     import sandy.core.scenegraph.*;
  9.     import sandy.core.*;
  10.     import sandy.extrusion.data.*;
  11.     import sandy.extrusion.*;
  12.     import sandy.materials.*;
  13.     import sandy.materials.attributes.*;
  14.     import sandy.primitive.*;
  15.     import sandy.*;
  16.     
  17.     [SWF(width="465", height="465", backgroundColor="#000000", frameRate="20")]
  18.     public class FlashTest extends Sprite
  19.     {
  20.         private var red:BitmapMaterial;
  21.         private var scene:Scene3D;
  22.         private var stuff:TransformGroup;
  23.         public function FlashTest () {
  24.             scene = new Scene3D ("scene"thisnew Camera3D (465465), new Group ("root"));
  25.             scene.camera.z = -1000; stuff = new TransformGroup ("stuff"); scene.root.addChild (stuff);
  26.             // get the logo
  27.             var logo:Bitmap = Logo.GetBitmap (); logo.y = 465 - 19; addChild (logo);
  28.             // make materials
  29.             red = new BitmapMaterial (makeSeamlessTextureFromLogo (logo),
  30.                 new MaterialAttributes (new VertexNormalAttributes (505, 0x007F00)));
  31.             var ph:PhongAttributes = new PhongAttributes (true);
  32.             ph.specular = 2; ph.gloss = 5; ph.onlySpecular = true;
  33.             var yel:ColorMaterial = new ColorMaterial (0xFFFFAF, 1,
  34.                 new MaterialAttributes (ph)); yel.lightingEnable = true;
  35.             // glowing sphere
  36.             var radius:Number = 100;
  37.             var sphere:Sphere = new Sphere ("sphere", radius);
  38.             sphere.appearance = new Appearance (yel);
  39.             sphere.container.filters = [ new GlowFilter (0xFFFFAF, 11601601) ];
  40.             stuff.addChild (sphere);
  41.             // make... emm... things
  42.             var profile:Polygon2D = new Polygon2D (
  43.                 [new Point (-10, -5), new Point (+10, -5), new Point (0, +10)]);
  44.             for (var i:int = 0; i < 6; i++) {
  45.                 var thing:Curve3D = new Curve3D;
  46.                 var up:Point3D = new Point3D (010);
  47.                 var t:Point3D = new Point3D (r(), r(), r());
  48.                 var len:Number = 0.5 * (1 + Math.random ());
  49.                 for (var j:int = 0; j < 4; j++) {
  50.                     // randomize direction
  51.                     var k:Number = 0.1 * (1.5 * j + 1);
  52.                     t.x += k * r(); t.y += k * r(); t.z += k * r(); t.normalize ();
  53.                     thing.t.push (t.clone ());
  54.                     // progressive position
  55.                     var v:Point3D = t.clone (); v.scale (radius * (0.9 + len * j));
  56.                     thing.v.push (v);
  57.                     // select any normal vector
  58.                     var n:Point3D = up.cross (t); n.normalize ();
  59.                     thing.n.push (n);
  60.                     // scale
  61.                     thing.s.push (3 - j);
  62.                 }
  63.                 var ext:Extrusion = new Extrusion ("thing" + i, profile, thing.toSections (), falsefalse);
  64.                 ext.appearance = new Appearance (red); stuff.addChild (ext);
  65.             }
  66.             // spin it
  67.             addEventListener ("enterFrame", loop);
  68.         }
  69.         private var tw:Number = 1, th:Number = 3, tu:Number = 0, tv:Number = 0;
  70.         private function loop (e:*):void {
  71.             tv -= 0.05if (tv < -1) tv += 1;
  72.             red.setTiling (tw, th, tu, tv);
  73.             stuff.rotateY += 2; scene.render();
  74.         }
  75.         private function makeSeamlessTextureFromLogo (logo:Bitmap):BitmapData {
  76.             var pattern:BitmapData = new BitmapData (2219 * 2 - 1false0);
  77.             pattern.draw (logo.bitmapData, new Matrix (+100, +1, -100));
  78.             pattern.draw (logo.bitmapData, new Matrix (-100, -1, +363.519 * 2 - 1));
  79.             return pattern;
  80.         }
  81.         private function r ():Number {
  82.             var v:Number = 0while (v == 0) v = Math.random () - Math.random (); return v;
  83.         }
  84.     }
  85. }
noswf
  1. // forked from makc3d's Hello Sandy 3D :)
  2. package  
  3. {
  4.     import flash.display.*;
  5.     import flash.filters.*;
  6.     import flash.geom.*;
  7.     import sandy.core.data.*;
  8.     import sandy.core.scenegraph.*;
  9.     import sandy.core.*;
  10.     import sandy.extrusion.data.*;
  11.     import sandy.extrusion.*;
  12.     import sandy.materials.*;
  13.     import sandy.materials.attributes.*;
  14.     import sandy.primitive.*;
  15.     import sandy.*;
  16.     [SWF(width="465", height="465", backgroundColor="#000000", frameRate="20")]
  17.     public class FlashTest extends Sprite
  18.     {
  19.         private var red:BitmapMaterial;
  20.         private var scene:Scene3D;
  21.         private var stuff:TransformGroup;
  22.         public function FlashTest () {
  23.             scene = new Scene3D ("scene"thisnew Camera3D (465465), new Group ("root"));
  24.             scene.camera.z = -1000; stuff = new TransformGroup ("stuff"); scene.root.addChild (stuff);
  25.             // get the logo
  26.             var logo:Bitmap = Logo.GetBitmap (); logo.y = 465 - 19; addChild (logo);
  27.             // make materials
  28.             red = new BitmapMaterial (makeSeamlessTextureFromLogo (logo),
  29.                 new MaterialAttributes (new VertexNormalAttributes (505, 0x007F00)));
  30.             var ph:PhongAttributes = new PhongAttributes (true);
  31.             ph.specular = 2; ph.gloss = 5; ph.onlySpecular = true;
  32.             var yel:ColorMaterial = new ColorMaterial (0xFFFFAF, 1,
  33.                 new MaterialAttributes (ph)); yel.lightingEnable = true;
  34.             // glowing sphere
  35.             var radius:Number = 100;
  36.             var sphere:Sphere = new Sphere ("sphere", radius);
  37.             sphere.appearance = new Appearance (yel);
  38.             sphere.container.filters = [ new GlowFilter (0xFFFFAF, 11601601) ];
  39.             stuff.addChild (sphere);
  40.             // make... emm... things
  41.             var profile:Polygon2D = new Polygon2D (
  42.                 [new Point (-10, -5), new Point (+10, -5), new Point (0, +10)]);
  43.             for (var i:int = 0; i < 6; i++) {
  44.                 var thing:Curve3D = new Curve3D;
  45.                 var up:Point3D = new Point3D (010);
  46.                 var t:Point3D = new Point3D (r(), r(), r());
  47.                 var len:Number = 0.5 * (1 + Math.random ());
  48.                 for (var j:int = 0; j < 4; j++) {
  49.                     // randomize direction
  50.                     var k:Number = 0.1 * (1.5 * j + 1);
  51.                     t.x += k * r(); t.y += k * r(); t.z += k * r(); t.normalize ();
  52.                     thing.t.push (t.clone ());
  53.                     // progressive position
  54.                     var v:Point3D = t.clone (); v.scale (radius * (0.9 + len * j));
  55.                     thing.v.push (v);
  56.                     // select any normal vector
  57.                     var n:Point3D = up.cross (t); n.normalize ();
  58.                     thing.n.push (n);
  59.                     // scale
  60.                     thing.s.push (3 - j);
  61.                 }
  62.                 var ext:Extrusion = new Extrusion ("thing" + i, profile, thing.toSections (), falsefalse);
  63.                 ext.appearance = new Appearance (red); stuff.addChild (ext);
  64.             }
  65.             // spin it
  66.             addEventListener ("enterFrame", loop);
  67.         }
  68.         private var tw:Number = 1, th:Number = 3, tu:Number = 0, tv:Number = 0;
  69.         private function loop (e:*):void {
  70.             tv -= 0.05if (tv < -1) tv += 1;
  71.             red.setTiling (tw, th, tu, tv);
  72.             stuff.rotateY += 2; scene.render();
  73.         }
  74.         private function makeSeamlessTextureFromLogo (logo:Bitmap):BitmapData {
  75.             var pattern:BitmapData = new BitmapData (2219 * 2 - 1false0);
  76.             pattern.draw (logo.bitmapData, new Matrix (+100, +1, -100));
  77.             pattern.draw (logo.bitmapData, new Matrix (-100, -1, +363.519 * 2 - 1));
  78.             return pattern;
  79.         }
  80.         private function r ():Number {
  81.             var v:Number = 0while (v == 0) v = Math.random () - Math.random (); return v;
  82.         }
  83.     }
  84. }
noswf
Get Adobe Flash Player