06-03-2007, 05:22 AM
|
#1
|
|
got as?
Join Date: May 2007
Posts: 628
|
challenge - moving flames as
ok you have to make moving flames that look realistic glows would help that move, contest begins now, it has to be all done in actionscript
|
|
|
06-03-2007, 06:13 AM
|
#2
|
|
got as?
Join Date: May 2007
Posts: 628
|
ok this will help
alright this will help you its a little tool i made that will show you a grid with an alpha of 20 then when you click on it it tells you the x and y position of the point you clicked on its at http://albert.teleinc.com/tool.zip
|
|
|
06-03-2007, 07:15 AM
|
#3
|
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,141
|
How in the world is that supposed to help people build flames???
The point of these contest is not to just take other people's code but to challenge them with some of your own.
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
|
|
|
06-03-2007, 03:58 PM
|
#4
|
|
got as?
Join Date: May 2007
Posts: 628
|
im not
first off thats just a tool i made to help you figure out were your line is on the x, y axis in as lineTo and stuff so we can build a realistic moving flame all done with actionscript
|
|
|
06-22-2007, 10:51 AM
|
#5
|
|
Registered User
Join Date: Jun 2007
Posts: 1
|
Hi ! That s my first post here !
Here's a small fire effect using BitmapData.
It's as2 and it takes a lot of ressources
Just move your mouse over the stage (compile in 40 fps )
Code:
import flash.filters.BlurFilter;
import flash.display.BitmapData ;
var mcBack : MovieClip = _root.createEmptyMovieClip("back",1);
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2);
Mouse.hide() ;
var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ;
var b = new BlurFilter(6,6,2);
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
bmp.draw(_root);
bmp.scroll(0,-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
|
|
|
06-23-2007, 02:22 PM
|
#6
|
|
Registered User
Join Date: Mar 2005
Posts: 106
|
Hi babeuf, and welcome.
Nice flame - I borrowed the basic principle and put it into AS3, seems to be a little less processor hungry.
(I'm sure my code could do with some work though - this is the first time I have played with AS3..)
ActionScript Code:
// flame colours
var outer_col:uint = 0xFF6600;
var inner_col:uint = 0xFFFF00;
// arrays to hold our flame parts
var outer_flame:Array = new Array();
var inner_flame:Array = new Array();
var circle:Sprite;
// setup blur to apply to flame elements
var blur:BlurFilter = new BlurFilter(30,30,2);
// paint the background black
this.graphics.beginFill(0x000000);
this.graphics.drawRect(0,0,550,400);
// create flames and draw dodgy looking candle
addFlameParts(outer_flame, outer_col, 275, 250, 40);
drawCandle();
addFlameParts(inner_flame, inner_col, 275, 270, 20);
// create a timer to call the update function
var timer:Timer = new Timer(80);
timer.addEventListener("timer", updateFlame);
timer.start();
// populate the flame arrays
function addFlameParts(holder_array:Array, flame_col:uint, xpos:int, ypos:int, diameter:uint):void {
for (var i:Number=0; i<20; i++) {
circle = new Sprite();
circle.graphics.beginFill(flame_col);
circle.graphics.drawCircle(xpos, ypos-(i*15), diameter);
circle.filters = [blur]
holder_array.push(circle);
addChild(circle);
diameter -= (diameter/10);
}
}
// update the flame
function updateFlame(t_evt:TimerEvent):void {
var offset:Number;
for(var i:Number=0; i<outer_flame.length; i++) {
offset = (Math.random()*6)-3;
Sprite(outer_flame[i]).x = offset;
Sprite(inner_flame[i]).x = offset;
}
}
// dodgy looking candle
function drawCandle():void {
// candle
this.graphics.beginFill(0xF8FEBC)
this.graphics.drawRect(175, 315, 200, 85);
this.graphics.beginFill(0xF8FEBC);
this.graphics.lineStyle(1, 0xF1FD82);
this.graphics.drawEllipse(175, 290, 200, 50);
// wick
this.graphics.lineStyle(6, 0x6D6D01, 1, false, "normal", null, null, 3);
this.graphics.moveTo(275, 225);
this.graphics.lineTo(275, 315);
}
Stu
Last edited by Stu; 06-25-2007 at 09:03 AM.
Reason: Added .fla (cs3) and .swf (flash9)
|
|
|
07-02-2007, 04:00 AM
|
#7
|
|
got as?
Join Date: May 2007
Posts: 628
|
ok
ok so we have ...
now can we make "mcFront.lineStyle" blend from 0xFFFF6600 to 0xFF66FF00 to 0x0066FF slowly?
ActionScript Code:
import flash.filters.BlurFilter;
import flash.display.BitmapData ;
var mcBack : MovieClip = _root.createEmptyMovieClip("back",1);
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2);
Mouse.hide() ;
var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ;
var b = new BlurFilter(6,6,2);
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
bmp.draw(_root);
bmp.scroll(0,-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
now can we make "mcFront.lineStyle" blend from 0xFFFF6600 to 0xFF66FF00 to 0x0066FF slowly?
Last edited by orange gold; 07-02-2007 at 04:03 AM.
|
|
|
07-04-2007, 02:57 AM
|
#8
|
|
got as?
Join Date: May 2007
Posts: 628
|
ok
ok here is what i have so far its good
ActionScript Code:
stop();
import flash.filters.BlurFilter;
import flash.display.BitmapData ;
var mcBack : MovieClip = _root.createEmptyMovieClip("back",1);
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2);
Mouse.hide() ;
var bmp : BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xFF000000) ;
var b = new BlurFilter(6,6,2);
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
bmp.draw(_root);
bmp.scroll(0,-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
_root.onMouseDown = function() {
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFF66FF00) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
bmp.draw(_root);
bmp.scroll(0,-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
_root.onMouseDown = function() {
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFF0066FF) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.5,.5);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
bmp.draw(_root);
bmp.scroll(0,-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
}
}
trace ("left click for more colors")
/********
add in
mcBack.onEnterFrame = function() {
this._alpha = this._alpha - 0.0005;
}
for a cool effect too
*********/
|
|
|
07-06-2007, 07:37 PM
|
#9
|
|
Chief Breaks-many-phones
Join Date: Jun 2007
Location: new york city
Posts: 527
|
Here's something to make it jitter a little. Can be worked on to make look better.. but adds a little realism.
Code:
stop();
import flash.filters.BlurFilter;
import flash.display.BitmapData ;
var mcBack : MovieClip = _root.createEmptyMovieClip("back",1);
var mcFront : MovieClip = _root.createEmptyMovieClip("front",2);
Mouse.hide() ;
var bmp:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0xF0F0F00) ;
var c1=6,c2=6,c3=2;
var b = new BlurFilter(c1,c2,c3);
mcBack.attachBitmap(bmp,1);
mcBack.filters = [b] ;
mcFront.lineStyle(10,0xFFFF6600) ;
mcFront.moveTo(0,0) ;
mcFront.lineTo(.2,1);
mcFront.filters = [b] ;
_root.onEnterFrame = function()
{
b = new BlurFilter(rand(1,8),6,c3);
mcFront.filters=[b]
bmp.draw(_root);
bmp.scroll(rand(-2,2),-4);
mcFront._x =_root._xmouse ;
mcFront._y = _root._ymouse;
}
function rand(low, high){
return Math.floor(Math.random() * (high - low)) + low
}
|
|
|
07-07-2007, 06:18 AM
|
#10
|
|
got as?
Join Date: May 2007
Posts: 628
|
ood job
good work it looks real good in fps 40
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 06:31 AM.
///
|
|