View Full Version : Spiderman
Hey,
I've seen Spiderman 2 recently, and I couldn't help wondering how they did their spiderwebs at the beginning of the movie. So if you guys want to try to make it in Flash...
pom :)
farafiro
08-10-2004, 12:19 PM
got any commercial for it?? I won't see it soon
Glad to see so many people are interested :D
Faffy >> Aren't there spiders in Egypt?
farafiro
08-15-2004, 12:14 PM
lol, nop
we eat them as they show up
;)
Jetbbal
08-16-2004, 08:11 PM
http://spiderman.sonypictures.com/
farafiro
08-17-2004, 06:31 AM
Thx Jetbbal, but I didn't find any " spiderwebs" in there
Jetbbal
08-17-2004, 10:39 PM
sry :o
thought they might have one in the trailers for the movie
farafiro
08-18-2004, 06:44 AM
nm mate
seems that pom went to sleep again
:p
Sure did :) I was on vacation. And I actually have trouble doing those darn spider webs :/
Laguana
08-26-2004, 09:10 AM
How's this for a basic spider web?
_root.createEmptyMovieClip("pen", 1)
_root.pen.moveTo(200,200)
_root.pen.lineStyle(5)
_root.xes = new Array()
_root.yes = new Array()
for ( i = 0; i < 7; i ++) {
point = ((2 *Math.PI) /8) * i + (Math.random() * ((2 * Math.PI) /7)
x = Math.cos(point) * 100
_root.xes[i] = x
y = Math.sin(point) * 100
_root.yes[i] = y
_root.pen.lineTo(200 + x, 200 + y)
_root.pen.moveTo(200, 200)
}
_root.pen.lineStyle(0)
for (i = 0; i < 50; i ++) {
strand = i % 7
x = _root.xes[strand] * i/50
y = _root.yes[strand] * i/50
_root.pen.lineTo(200 + x, 200 + i)
}
I know it's not the most asthetically pleasing thing, and it's probably inefficient, but it's my first go at these challanges :)
You can change the numbers to get different styles of web, such as having the first loop going until i < 19, changing the 8 to a 20, the 7's to 19s and the 50 to 500s. however, you'll need to change the line style to get some kind of visible image. I find 0 is good for that one.
Hope you like it.
Laguana
08-26-2004, 12:20 PM
This one should have curvy lines... strange thing is, i dunno why it works :p It also has easier to change variables, though it took 2 extra lines ;)
_root.createEmptyMovieClip("pen",1)
_root.pen.moveTo(200,200)
_root.pen.lineStyle(5)
_root.xes = new Array()
_root.yes = new Array()
_root.spokes = 7
_root.web = 50
for ( i = 1; i < _root.spokes; i ++) {
_root.point. = ((2 * Math.PI)/ _root.spokes) * (i-1) + (Math.random() * ((2 * Math.PI)/_root.spokes)
x = (Math.cos(_root.point) * 100)
_root.xes[i] = x
y = (Math.sin(_root.point) * 100)
_root.yes[i] = y
_root.pen.lineTo(200 + x, 200 + y)
_root.pen.moveTo(200,200)
}
_root.pen.lineStyle(0)
for (i = 0; i <_root.web; i ++) {
spoke = i % _root.spokes
x = _root.xes[spoke] * i/_root.web
y = _root.yes[spoke] * i/_root.web
midx = (_root.pen._x + x - 200) /2 //Working out the midpoint, so it can curve toward it a bit
midy = (_root.pen._y + y - 200) /2
_root.pen.curveTo((midx*0.99) + 300, (midy * 0.99) + 300, 200 + x, 200 + y) //This is the line which i don't know why it works.
// I would think that the two 300's should be 200s, but if i do that it goes all odd. Any comments would be appreciated
}
Laguana
08-27-2004, 08:43 AM
Yeah, me again. Nobody else seems to be posting anything... I worked out what my mistake was though, and now i understand what it's doing. Or at least i think i do ;) It prints when you click on it too :)
_root.createEmptyMovieClip("pen", 1)
_root.pen.moveTo(200, 200)
_root.pen.lineStyle(5)
_root.xes = new Array()
_root.yes = new Array()
for (i = 0; i < 7; i ++) {
_root.point = (((2*Math.PI)/7) * (i-1)) + (Math.random() * ((2*Math.PI)/7))
x = (Math.cos(_root.point) * 200)
_root.xes[i] = x
y = (Math.sin(_root.point) * 200)
_root.yes[i] = y
_root.pen.lineTo(200 + x,200 + y)
_root.pen.moveTo(200, 200)}
_root.pen.lineStyle(0)
for (i = 0; i < 50; i++) {
strand = i % 7
midx = (x2 + (_root.xes[strand] * i/50)) /2
midy = (y2 + (_root.yes[strand] * i/50)) /2
x2 = _root.xes[strand] * i/50
y2 = _root.yes[strand] * i/50
_root.pen.curveTo((midx * 0.8) + 200, (midy * 0.8) + 200,200 + x2, 200 + y2)}
_root.pen.onRelease = function() {print(_root, "bframe")}
You can get some really cool effects by changing the value of the 0.8 at the end to something relative to the centre, but ti's much less spider web looking. There were also several times i had it looking like a washing line, with the wire hanging down ;) But i think i'll shut up now, so i don't look like too much of a rambler.
Only the last one works for me :) Very nice effect, by the way!
Here's mine:function spiderWeb () {
var webs = 6 + random (6) ;
var ang = 2 * Math.PI / webs ;
var numC = 10 ;
var x=Stage.width/2 ;
var y=Stage.height/2 ;
this.lineStyle (0, 0, 100) ;
for (var i=0; i < webs; i++) {
this.moveTo (x, y) ;
angs.push (i * ang + (Math.random() - .5) * 10) ;
this.lineTo (x + 400 * Math.cos (i * ang), y + 400 * Math.sin (i * ang)) ;
} ;
var xp, yp ;
for (var j=1; j <= numC; j++) {
xp = 300 / j ;
yp = 0 ;
this.moveTo (x + xp, y + yp) ;
for (var k=1; k < webs; k++) {
/* if (Math.random() < .8) this.lineStyle (0, 0, 100) ;
else this.lineStyle (0, 0, 0) ;*/
var d = (300 + (Math.random()-.5) * 60) / j ;
xp = d * Math.cos (k * ang) ;
yp = d * Math.sin (k * ang) ;
this.lineTo (x + xp, y + yp) ;
} ;
this.lineTo (x + 300 / j, y) ;
} ;
}
spiderWeb () ;It's 29 lines, but I declared a few variables at the beginning to make it a bit more clear. If you uncomment the 2 lines in the middle, it makes some of the threads, but it doesn't look that good :-\
Laguana
08-28-2004, 12:34 PM
Yeah, i think i may have typo'd the first two things i posted. I've been doing it on a laptop which doesn't have an internet connection, then copying it across via reading it, and i haven't checked it (because this computer has something of a deathwish relating to flash... or really anything). It's been quite a learning experience for me though. I made *so* many stupid mistakes in the first two, but now i understand it! i think ;)
I couldn't seem to get yours to work... I did notice, however, that you made an "angs" but never used it again.
Yep, I removed angs. I've used it in version 2.0 of my spider webs, to have a less regular angle with the main threads. It looks really better by the way :) Couldn't upload it yesterday, I'll do it tonight.
Use a black background:// pom
function spiderWeb () {
var webs = 10 + random (6) ;
var ang = 2 * Math.PI / webs ;
var angs = [] ;
var numC = 15 ;
var x=Stage.width/2 ;
var y=Stage.height/2
for (var i=0; i < webs; i++) {
this.lineStyle (0, 0xffffff, 60 + random (40)) ;
this.moveTo (x, y) ;
angs.push (i * ang + (Math.random() - .5) * .5) ;
this.lineTo (x + 400 * Math.cos (angs[i]), y + 400 * Math.sin (angs[i])) ;
} ;
var xn, yn, dx, dy, dl ;
for (var j=1; j < numC; j++) {
xp = 300 / j * Math.cos (angs[0]) ;
yp = 300 / j * Math.sin (angs[0]) ;
this.moveTo (x + xp, y + yp) ;
for (var k=0; k < webs; k++) {
var d = (300 + (Math.random()-.5) * 50) / j ;
xn = d * Math.cos (angs[k]) ;
yn = d * Math.sin (angs[k]) ;
dx = xn - xp ;
dy = yn - yp ;
xp = xn ;
yp = yn ;
dl = Math.sqrt (dx * dx + dy * dy) ;
this.lineStyle (0, 0xffffff, Math.max (100-dl/1.5, 0)) ;
this.lineTo (x + xp, y + yp) ;
} ;
this.lineTo (x + 300 / j * Math.cos (angs[0]), y + 300 / j * Math.sin (angs[0])) ;
} ;
}
spiderWeb () ;
farafiro
09-01-2004, 06:38 AM
I think this thread should be moved to the Just for Kicks Challenges forum
And I think you should quite smoking illegal substances this early, Faffy :rolleyes: ActionScript.org -- FORUMS > Community Boards > Just for Kicks Challenges > Spiderman
farafiro
09-01-2004, 09:14 AM
OOOps, heheheeeeeee
yup, I should do this.
I donno I've always had the thought that you firstly posted this in the General Chat
:red face:
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.