Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Community Boards > Just for Kicks Challenges

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-01-2004, 08:16 AM   #1
Laguana
Well known nobody
 
Join Date: Jul 2004
Location: Australia
Posts: 818
Default Fractals!

Yes, it's those shapes we all know and love. Well, maybe not all, and perhaps not love. But anyway, how cool are they? They repeat, and you can just keep going and going... I was inspired by these to make my own fractal generator... and i decided to try to keep to these rule things so i could send it in here :P. With my dad's help, i managed to make one which is of repeating triangles, and it is as follows (you can even print it, though it's about 2.21 MB :P)

ActionScript Code:
_root.createEmptyMovieClip("Pen", 1) _root.pen.lineStyle(0) _root.triangle = function(Long, x, y) {     _root.pen.moveTo(x,y)     _root.pen.lineTo(x + Long, y + Math.sqrt(3) * Long)     _root.pen.lineTo(x - Long, y + Math.sqrt(3) * Long)     _root.pen.lineTo(x,y) } lengthvar = 256; ax=4; ay=4 _root.triangle(-lengthvar,lengthvar + ax, Math.sqrt(3) * lengthvar + ay) _root.fractal = function(lengthvarq, axq, ayq, max) {     for (i = 0; i <max+1; i ++) {         max--         axq+= lengthvarq         lengthvarq*=0.5         _root.triangle(lengthvarq, axq, ayq)         _root.fractal(lengthvarq, axq - 2 * lengthvarq, ayq, max)         _root.fractal(lengthvarq, axq, ayq, max)         _root.fractal(lengthvarq, axq - lengthvarq, ayq + Math.sqrt(3)*lengthvarq, max)     } } _root.fractal(lengthvar, ax, ay, 8) _root.pen.onRelease = function() {print(_root, "bframe")} Mouse.addListener(_root.pen)

However, this is a pretty inefficient way of doing things (as you may notice if you run it). How's about we see what else we can make?

Last edited by Laguana; 09-01-2004 at 08:43 AM.. Reason: Silly mistake with the printing
Laguana is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.