Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GifMaterial added #662

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

GifMaterial added #662

wants to merge 4 commits into from

Conversation

peteshand
Copy link

Gif Texture, Material and Method can be used to load and display animated gifs within an away3d material
Dependencies:
My fork of "Flash-Animated-GIF-Library"
https://github.com/peteshand/Flash-Animated-GIF-Library

Pete Shand added 4 commits December 3, 2013 21:17
single spritesheet now working
spritesheet bitmapdata max size reduced if whole 2048x2048 isn't used
padding added to packing
@mkfui
Copy link

mkfui commented Oct 28, 2016

var stream:URLStream = new URLStream();
gifLinkToByteArray(“diego.gif”);

function gifLinkToByteArray(url:String){
stream.addEventListener( Event.COMPLETE, completeHandler );
stream.load(new URLRequest(url));
}
function completeHandler( e:Event ):void {
var bytes:ByteArray = new ByteArray();
stream.readBytes( bytes );
gPlayer = new GIFPlayer(true);
gPlayer.addEventListener(GIFPlayerEvent.COMPLETE, OnDecodeComplete);
gPlayer.loadBytes(bytes);
}

var tex:GifTexture = new GifTexture(gPlayer);
var gifMaterial:GifMaterial = new GifMaterial(tex);

var geo:PlaneGeometry = new PlaneGeometry(100, 100, 1, 1, false);
var mesh:Mesh = new Mesh(geo, gifMaterial);
_view.scene.addChild(mesh);

private function OnDecodeComplete(ev:GIFPlayerEvent):void
{

gPlayer.resize(0.25, 0.25);
}

sir, not work, TypeError: Error #1009: Cannot access a property or method of a null object reference.

by this way,

gPlayer = new GIFPlayer(true);
gPlayer.addEventListener(GIFPlayerEvent.COMPLETE, OnDecodeComplete);
gPlayer.loadBytes(new mygif());

got this [Fault] exception, information=ArgumentError: Error #2015: Invalid BitmapData.

can anyone demonstrate it for me ? i need it urgently

@peteshand
Copy link
Author

Hey @mkfui you can download a sample app from https://github.com/peteshand/awy3dGifExample

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants