.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Curve text animation

0 komentar

Animation flash. Text effects.

My curve text writer animation.

An interesting idea cam in to my space. It's curve text animation. Effect like as type writer, but simply as a pen move by paper. I am made it by Flash Develop (FD) and Inkscape software.
At first I made bitmap text in Inkscape and a curve. The curve I will use like a guide to pen move on. Pen will made a mask to text:"All You Need Is Love!!!"
In Inkscape I call the page setup (Shift+ctrl+D) to set width 550 and height 400 [OK], when I write some text (look at screen shot).
bitmap text
bitmap text screen shot

The next step I made export to raster (Shift+Ctr+E), to click the page button and push export. It's operation made the bitmap.png file. Now I draw by my hand curve guide.
text animation guide
text animation guide for writing effect screen shot

At last I deleted the text in Inkscape, and save curve image as (Shift+Crl+S) sk1 graphics. Sk1 is easy format, I will parse it to the curve guide.
I write some small action script code.

package
{
import flash.display.*;
import flash.events.Event;
import flash.geom.Rectangle;
import flash.utils.*;
import lex.sk1.*;
/**
* ...
* @author Lexcuk
*/
public class TextCurveAnimationDoc extends Sprite
{
[Embed(source = "bitmap.png")]
public var bitmapPng:Class;

[Embed(source = "curve-text.sk1", mimeType = "application/octet-stream")]
public var sk1Class:Class;

public var grPath:LexGraphPath;

public var leterSprite:Sprite;
public var maskSprite:Sprite;
public var maskBitmapdata:BitmapData;

public var penSprite:Sprite;
public var bigPenSprite:Sprite;
public var bigPenParentSprite:Sprite;

public var penCount:int;
public function TextCurveAnimationDoc()
{
var dataStr:String = (new sk1Class()).toString();
var strArr:Array = dataStr.split('\n');
var s:String = '';
var color:uint;
pathArr = new Vector.<LexGraphPath>();
var pathArr:Vector.<LexGraphPath>;

trace(strArr);
Sk1.sk1Height = 400;//!!!
for (var i:int = 0; i < strArr.length; i++) {
s = strArr[i];
if (s.indexOf('lp') == 0) {
color = Sk1.parseLp(s);
trace(color.toString(16));
var comArr:Vector.<GraphComand> = Sk1.createPath(strArr, i, color);
grPath = new LexGraphPath(color);
grPath.pathArr = comArr;
grPath.pointArr = grPath.converToPoint(2);//segmentSize
pathArr.push(grPath);
}
}

addChild(leterSprite = new Sprite());
leterSprite.addChild(new bitmapPng());

addChild(maskSprite = new Sprite());
maskSprite.addChild(new Bitmap(maskBitmapdata = new BitmapData(550, 400, true, 0x00000000)));

leterSprite.cacheAsBitmap = maskSprite.cacheAsBitmap = true;

leterSprite.mask = maskSprite;

addChild(penSprite = new Sprite());
penSprite.graphics.beginFill(0xFF0000);
penSprite.graphics.drawCircle(0, 0, 5);

bigPenParentSprite = new Sprite();
bigPenParentSprite.addChild(bigPenSprite = new Sprite())
bigPenSprite.graphics.beginFill(0x000000);
bigPenSprite.graphics.drawCircle(0, 0, 10);

addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}

public function enterFrameHandler(e:Event):void {
if (penCount >= grPath.pointArr.length) {
maskBitmapdata.fillRect(new Rectangle(0, 0, 550, 400), 0x00000000);
penCount = 0;
}
penSprite.x = bigPenSprite.x = grPath.pointArr[penCount].x;
penSprite.y = bigPenSprite.y = grPath.pointArr[penCount].y;
maskBitmapdata.draw(bigPenParentSprite);
penCount++;
}

}

}


The library sk1 and sample code you can find in source.
Suni

Alternativa3D box and shadow

0 komentar

Alternativa3D "Hello world + shadow + box!" application

I am test a open source now the alternativa engine 3d, because I like to make 3d game with flash 11.
I rewrite a standard application 'Hello world' to add shadow in this one. I am happy!!! It's easy.
Alternativa3D box shadow screen shot
Alternativa3D box shadow screen shot.



package {

import alternativa.engine3d.controllers.*;
import alternativa.engine3d.core.*;
import alternativa.engine3d.lights.*;
import alternativa.engine3d.materials.*;
import alternativa.engine3d.primitives.*;
import alternativa.engine3d.resources.*;
import alternativa.engine3d.shadows.*;

import flash.display.*;
import flash.events.*;

/**
* Alternativa3D "Hello world + shadow + box!" application.
*/
public class HelloAlternativa3D extends Sprite {
private var rootContainer:Object3D = new Object3D();
private var camera:Camera3D;
private var stage3D:Stage3D;
private var box:Box;

public function HelloAlternativa3D() {

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;


stage3D = stage.stage3Ds[0];
stage3D.addEventListener(Event.CONTEXT3D_CREATE, onContextCreate);
stage3D.requestContext3D();
}

private function onContextCreate(e:Event):void {

var grass_diffuse:BitmapTextureResource = new BitmapTextureResource(new BitmapData(1, 1, false, 0xFF0000));

var grass_normal:BitmapTextureResource = new BitmapTextureResource(new BitmapData(1, 1, false, 0x7F7FFF));

var box_normal:BitmapTextureResource = new BitmapTextureResource(new BitmapData(1, 1, false, 0xFFFFFF));

grass_diffuse.upload(stage3D.context3D);
grass_normal.upload(stage3D.context3D);
box_normal.upload(stage3D.context3D);

// Camera and view
camera = new Camera3D(0.1, 10000);
camera.view = new View(stage.stageWidth, stage.stageHeight, false, 0, 0, 4);
addChild(camera.view);
addChild(camera.diagram);

// Initial position
camera.rotationX = -120*Math.PI/180;
camera.y = -800;
camera.z = 400;
rootContainer.addChild(camera);

// Light sources
var ambientLight:AmbientLight = new AmbientLight(0x333333);
ambientLight.intensity = 3;

ambientLight.z = 200;
ambientLight.y = -200;
ambientLight.x = 200;

rootContainer.addChild(ambientLight);

var directionalLight:DirectionalLight = new DirectionalLight(0xFFFF99);

directionalLight.z = 20000;
directionalLight.y = -20000;
directionalLight.x = 20000;
directionalLight.intensity = 1;

directionalLight.lookAt(2000, 0, 0);
rootContainer.addChild(directionalLight);

// Primitive box
box = new Box(150, 150, 150, 1, 1, 1, false);
box.z = 100;

var material:VertexLightTextureMaterial = new VertexLightTextureMaterial(grass_normal, box_normal, 1);

box.setMaterialToAllSurfaces(material);
rootContainer.addChild(box);

var plane:Plane = new Plane(800, 800);
var planeMaterial:StandardMaterial = new StandardMaterial(grass_diffuse, grass_normal);
plane.setMaterialToAllSurfaces(planeMaterial);

rootContainer.addChild(plane);


// Shadow
var shadow:DirectionalLightShadow = new DirectionalLightShadow(1000, 1000, -500, 500, 512, 2);
shadow.biasMultiplier = 0.97;
//shadow.addCaster(plane);
shadow.addCaster(box);
directionalLight.shadow = shadow;


for each (var resource:Resource in rootContainer.getResources(true)) {
resource.upload(stage3D.context3D);
}


// Listeners
stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}

private function onEnterFrame(e:Event):void {
// Width and height of view
camera.view.width = stage.stageWidth;
camera.view.height = stage.stageHeight;

// Rotation
box.rotationZ -= 0.01;

// Render
camera.render(stage3D);
}

}
}


Alternativa shadow cube source zip Flash Develop project.
I made Alternativa3d and jiglib.
Suni
0 komentar
Flash page flip. Updates 11.06.2012.
+ Control bar with flipping book.
+ flip the page sound.
+ pages flip dynamical loading with xml text+(png, jpg, gif);

This page flipping (Flash develop) is free and open source.

How-to made xml as png for fotohosting.
I made for example xml file.

<data>
<width>150</width>
<height>200</height>
<page />
<page>
<background>first</background>
<txt>
<width>140</width>
<height>200</height>
<x>20</x>
<y>20</y>
<str>
<![CDATA[ <font size="30">STORY</font>
]]>
</str>
</txt>

<loader>
<url>https://sites.google.com/site/murmadillo/content/cat.swf</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>25</x>
<y>70</y>
</loader>

<txt>
<width>140</width>
<height>200</height>
<x>10</x>
<y>180</y>
<str>
<![CDATA[ <a href="goto_next"><font size="12">next page</font></a>
]]>
</str>
</txt>

</page>

<page>
<background>two</background>
<halfline />

<txt>
<width>120</width>
<height>200</height>
<x>-130</x>
<y>10</y>
<str>
<![CDATA[ <font size ='20' color="##FF8000">Surprise!!! </font><br>Take the one.<br>That is yours?
]]>
</str>
</txt>

<loader>
<url>https://sites.google.com/site/murmadillo/content/sur.jpg</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>0</x>
<y>5</y>
</loader>

</page>

<page>
<background>two</background>
<halfline />
<loader>
<url>https://sites.google.com/site/murmadillo/content/son.jpg</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>-140</x>
<y>0</y>
</loader>

<txt>
<width>170</width>
<height>200</height>
<x>-20</x>
<y>0</y>
<str>
<![CDATA[ <font color="#FFFFFF">Silver is a friend of yours.</font>
]]>
</str>
</txt>

</page>

<page>
<background>two</background>
<halfline />
<loader>
<url>https://sites.google.com/site/murmadillo/content/mario.jpg</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>-140</x>
<y>10</y>
</loader>

<txt>
<width>140</width>
<height>200</height>
<x>20</x>
<y>0</y>
- <str>
<![CDATA[ That yours cats name?<br>His name is<font color="#FFFFFF"></font>
]]>
</str>
</txt>

<txt>
<width>300</width>
<height>200</height>
<x>-20</x>
<y>150</y>
<rotation>-50</rotation>
<scaleX>0.85</scaleX>
<str>
<![CDATA[ <font size ='50' color="#FF0000"><b>MARIO!!!</b></font>
]]>
</str>
</txt>
</page>

<page>
<background>last</background>
<loader>
<href>http://www.kongregate.com/games/Lexcuk/rat-rods-ralli</href>
<url>https://sites.google.com/site/murmadillo/content/start.gif</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>-133</x>
<y>10</y>
</loader>
<txt>
<width>140</width>
<height>100</height>
<x>-140</x>
<y>150</y>
<str>
<![CDATA[ <a href = 'http://www.kongregate.com/games/Lexcuk/rat-rods-ralli'><font color="#FF0000">Play Rat Rods - Game</font> </a><br><a href = 'goto_1'>First page</a>
]]>
</str>
</txt>
<loader>
<href>goto_1</href>
<url>https://sites.google.com/site/murmadillo/content/first.png</url>
<scaleX>1</scaleX>
<scaleY>1</scaleY>
<x>-50</x>
<y>170</y>
</loader>
</page>
</data>

and made xml to png
Xml as png. Give you attention on top line of the picture, other field is black (0x000000)

Dynamical flip the page source (it's Flash develop project).
Suni
0 komentar
Flash xml to png and xml.png to xml. I try to load xml file on photohoster. It's work! XMl to PNG
.

text or xml to png source.

Converter xml.png to xml
package  
{
import com.adobe.images.PNGEncoder;
import flash.display.*;
import flash.events.Event;
import flash.net.*;
import flash.text.*;
import lex.net.DimBitmapLoader;

import flash.utils.ByteArray;
import com.adobe.images.JPGEncoder;
import lex.comp.LexBorderTxt;
import lex.comp.LexButton;
import lex.comp.LexTextSlBox;


import lex.comp.colorTool.*;
/**
* ...
* @author Lexcuk
*/
public class BitmapToTextDoc extends Sprite
{
private var dLoader:DimBitmapLoader;
private var txt:LexTextSlBox;
private var btn:LexButton;

public function BitmapToTextDoc()
{
dLoader = new DimBitmapLoader();
dLoader.addEventListener(Event.COMPLETE, completeHandler);
dLoader.load(new URLRequest('str.png'));
txt = new LexTextSlBox(550, 400);
addChild(txt.sprite);
txt.sprite.y = 20;
}

private function completeHandler(e:Event):void {
var bmd:BitmapData = dLoader.bitmapData;
var ba:ByteArray = new ByteArray();
var i:int;
var j:int;
for (j = 0; j < bmd.height; j++)
for (i = 0; i < bmd.width; i++) {
var p:uint = bmd.getPixel(i, j);
var colorCom:ColorCom = new ColorCom(p);
if (colorCom.r == 0) break;
ba.writeByte(colorCom.r);
if (colorCom.g == 0) break;
ba.writeByte(colorCom.g);
if (colorCom.b == 0) break;
ba.writeByte(colorCom.b);
}
trace (ba.toString());
txt.txt.text = ba.toString();
}



public function rgbToUint(r:uint, g:uint, b:uint):uint {
var c:ColorCom = new ColorCom();
c.r = r;
c.g = g;
c.b = b;
return c.color;
}

}

}

my png to text or xml, source.

Suni

Tawk.to