A Flash Developer Resource Site

Results 1 to 11 of 11

Thread: lava lamp effect..

  1. #1
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747

    lava lamp effect..

    I am looking at achieving an effect similar to that on neave's homepage, the 'lava lamp' effect around the edge of the site that the user can play with..

    Any ideas on how this can be achieved without animation?

    Cheers!

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    you mean http://www.neave.com/neave_blob.swf? it uses curveTo-s.
    who is this? a word of friendly advice: FFS stop using AS2

  3. #3
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    yea,

    although strangely after i posted this i have noticed this thread:

    http://board.flashkit.com/board/showthread.php?t=741166

    on displacement maps, i am wondering if that would be a faster way to do a similar thing. Really need to get up to date on all these f8 functions :-(

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    since page ~3 they do it with lineTo-s there
    who is this? a word of friendly advice: FFS stop using AS2

  5. #5
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    made this a while ago, uses AS1 classes
    Code:
    function Line(x, y){
    	
    	this.x = x;
    	this.y = y;
    	
    	this.px = x;
    	this.py = y;
    	
    	this.vx = this.vy = 0;
    	
    	lines.push(this);
    }
    
    Line.prototype.control = function(){
    	
    	var mx = circle._xmouse;
    	var my = circle._ymouse;
    	
    	var dx = mx - this.x;
    	var dy = my - this.y;
    	
    	var sx = dx > 0 ? -1 : 1;
    	var sy = dy > 0 ? -1 : 1;
    
    	var fx = 0;
    	var fy = 0;
    	
    	var d = dx * dx + dy * dy;
    	
    	if(d < dist){
    		var force = (-1*a*d)+power;
    		fx = (dx*dx) / d*sx*force;
    		fy = (dy*dy) / d*sy*force;
    	}
    	
    	this.vx = (this.vx * friction) + ((this.px - this.x) * spring) + fx;
    	this.vy = (this.vy * friction) + ((this.py - this.y) * spring) + fy;
    	
    	this.x += this.vx
    	this.y += this.vy
    }
    
    Line.prototype.draw = function(l){
    	
    	var mx = (this.x + l.x) / 2
    	var my = (this.y + l.y) / 2	
    	
    	circle.curveTo(this.x, this.y, mx, my)	
    }
    
    var circle = createEmptyMovieClip("circle", 0);
    var lines = [];
    
    var power = 10
    var spring = .1;
    var friction = .9;
    var distance = 60;
    
    var dist = distance*distance;
    var a = power / dist;
    
    var num = 10;
    var radius = 100;
    
    for(var i=0; i<num; i++){
    	
    	var n = (i/num) * (Math.PI*2)
    	var x = radius * Math.cos(n)
    	var y = radius * Math.sin(n)
    	
    	var l = new Line(x, y)
    }
    
    circle._x = Stage.width / 2;
    circle._y = Stage.height / 2;	
    
    onEnterFrame = function(){
    
    	var length = lines.length;
    	var i = length;
    	
    	while(--i >= 0)	lines[i].control();
    	
    	//start draw
    	var sx = (lines[0].x + lines[length-1].x) / 2
    	var sy = (lines[0].y + lines[length-1].y) / 2
    
    	circle.clear()
    	circle.beginFill(0xFF0000, 100)
    	circle.moveTo(sx, sy)
    	
    	var i = length
    	
    	while(--i >= 0) lines[i].draw(lines[i-1] || lines[length-1]);
    	
    	circle.endFill()
    }
    the physics is exactly the same as that used in the displacementMap filter example. Can't take credit for that, its from liquidJourney
    lather yourself up with soap - soap arcade

  6. #6
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    AS1 classes? The thing you're doing is just pure garbage hacking Good stuff though.

  7. #7
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    Cheers gang

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  8. #8
    Zombie Coder EvilKris's Avatar
    Join Date
    Jun 2006
    Location
    Fukuoka, Japan.
    Posts
    796
    Whoah, gets me green with envy when I see a site design that inspirational...

  9. #9
    Banned
    Join Date
    Mar 2009
    Location
    www.rjflash.com
    Posts
    8

    Lightbulb It's not CurveTo or anything advanced in blobs

    It's nothing spectacular in programming,
    but this effect uses filters and simple math to
    create the appearance of Realistic Glowing Lava Lamp Blobs..






    And don't forget to check out:
    Realistic Glowing Candle and Flame



    Check it all out at: rjflash.com

    www.rjflash.com

    If you ask kindly, I can give you FREE fla files or fla help



    Thanks for lookin'!
    Last edited by RJ-Flash; 03-28-2009 at 08:06 PM. Reason: changed images from png to jpg

  10. #10
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    I will be so kind and inform you that this thread is back from 2007 so almost 2 years old. So if all you want is pimping why not create a new thread instead? because the original posters propably dont care anymore by now.

    besides that it looks that you rather want to pimp your domain (some might consider that as spam)

    no need to get angry - Tony
    Last edited by tonypa; 03-29-2009 at 03:20 AM.

  11. #11
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    maybe i do still care.. eh, eh?!

    ahh, who am i kidding - i don't even remember what this was for!

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center