Your Ad Here

Sunday, September 27, 2009

Flash Papervision 3D - 3D Animation Using Cube Class | Part 1

Its a nice 3D rotation type of effect, you can say it a sort of 3D animation. The cube will rotate around the camera according to your mouse movements, to give an illusion of 3D rotation. Wann view the 3D animation.

Using Papervision 3D API, Action Script 3.0 and by the help of Plane Class of Papervision 3D this small application is developed. You need Flex SDK for compiling this stuff. Its free available for developing application.

Source Code:

import org.papervision3d.scenes.*;
import org.papervision3d.objects.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;

// Create the container Sprite
var container:Sprite = new Sprite();
container.x = stage.stageWidth * 0.5;
container.y = stage.stageHeight * 0.5;

// Setup the 3D scene
var scene:Scene3D = new Scene3D(container);
var camera:Camera3D = new Camera3D();
camera.zoom = 5;

// Create the material
var bam:BitmapAssetMaterial = new BitmapAssetMaterial("layer");// layer is the class name for the bitmap image imported to the library
bam.oneSide = false;
bam.smooth = true;

// Create the 3D cubes
var c:Cube = new Cube(bam, 300, 300, 335, 5, 5, 5);

this.addEventListener(Event.ENTER_FRAME, render);

function render(e:Event):void
    camera.x = (mouseX * 5)-(stage.width*0.5);
    camera.y = (mouseY * 5)-(stage.height*0.5);
    c.rotationX += 5;
    c.rotationY += 5;

3D rotating cube animation by ~Biti-24X7 on deviantART

Bookmark and Share


Anonymous said...

Business organizations have to realize the fact that many people just click away to some other website, because the website they are looking at is not professional looking or is not interesting enough. Only a well designed website can serve the purpose of its existence.
Once the website is designed up to the mark, then comes the role of SEO because a well designed website won’t serve it’s purpose until and unless it has a good search ranking. Globally India is the most sort after for such solutions. There are many companies in India that provide solutions for web designing ecommerce and website seo development and in their race of being the best Virtual Studio is leading the way.

Anonymous said...

You have a really informative website. pls continue sharing. ;)
Web business model

Post a Comment

Type here your comments