achieve this lightning effect

For questions about using Classic.

Post » Sun May 27, 2012 1:10 pm

@ newt Yes, but how to make, with 1 line(many instances of it).

How to pick the right one, because the 2nd start = the first end, the 3rd start = the 2nd end....a clever "for each" solution I think would be enough.

I'll try that now, thanks.zyblade2012-05-27 13:10:33
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sun May 27, 2012 3:51 pm

Here I come:

http://dl.dropbox.com/u/26932498/electric.cap

I used r0j0hounds ribbon example as a base. I could use lines instead of, but for now, this is what I've got. The sprite is from the electric demo on the site as you maybe already recognized^^

What I still need to do is:

1) If I drag the last box, I need to rearrange the other ones relative to the first+last so it's again "one line".

2) I want the y position of each point, beeing max distance to the next one = $variable(for example 50), so if the first one is on self.y + 45, the next one couldn't be self.y - 10 or lower. Because the max different is 50 and 45 - 50 = -5.

If that works, it looks much better and not that...(insert adjective here)

I hope my explanation was good enough, since I still need to improve my english ><

edit: Just talked with tulamide and he says, it's possible with his splines: http://www.scirra.com/forum/advanced-interpolation-splines_topic49366.html. Since this math is a bit too high for me, maybe someone else knows?
Normally I don't let the work do by other :/ really, but this is just too heavy^^.zyblade2012-05-27 18:41:22
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sun May 27, 2012 7:13 pm

Yep, the flash example uses splines, and you could achieve something similar with CC. But why doing all that work (and it is a lot of work) if there already is a nice looking solution using the ribbon object and distortion?
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon May 28, 2012 2:38 am

Yeah, spline would be almost like perlin, in that it would be a curve. You want the peaks, and jaggedness.

Also if you go with a distortmap you wouldn't have to pick objects, you would just figure the coords.
Like set columns to int(distance(sprite.x,sprite.y,sprite2.x,sprite2.y)/10)
Then set the random xy's in a loop to lerp(sprite.x,sprite2.x,loopindex/distance(sprite.x,sprite.y,sprite2.x,sprite2.y)+normalrandom(0,64)newt2012-05-28 02:41:26
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon May 28, 2012 10:51 am

@newt I don't know how where to put your formula exact, but thank you for all your help. Displacement and distorting maps is just a new challenge for me, I never worked with it and can't use your formula(yet). But I save it to my tutorial collection until I get further into it.
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Mon May 28, 2012 12:08 pm

i tried to achieve the wanted effect without using displacement. instead it works via sprite instances, which are being stretched/rotated/moved by perlin. i'm well aware that this approach might not be thaaat efficient, but at least i wanted to try it out with coherent noise ;)

here's the CAP

a few hints:
- press Space to toggle the fade behaviour
- play around with Size in the Noise-Settings, it represents the "Step" setting in the flash example. But beware, the higher the value, the more instances are being created (i suggest not going higher than 512 with fade off)
- global("OffsetY") determines the amplitude
- take a look at the Noise-settings in "FillArray".. especially Frequency is of interest
B
59
S
7
G
2
Posts: 93
Reputation: 4,228

Post » Mon May 28, 2012 12:55 pm

@oppenheimer
Its pretty.

Couple thoughts. You could try the Canvas object and draw the noise. That might speed things up a bit, but I think the biggest pull is coming from constantly randomizing noise.
You could (in theory) generate a few arrays filled with the noise on start up, and go back and forth between them.
Of course setting that up takes some effort as they don't have variables for picking. So you could either add copies of the object (noise, or array), or create instances by placing them in containers with an object that has variables to pick, sprite etc.
newt2012-05-28 12:56:22
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Mon May 28, 2012 2:04 pm

@ oppenheimer, wow, that's the best looking example so far^^.
2 Questions I have. Is there a way, letting the first few and the last few sprites not moving that low/high? So it looks more, like the have a fixed start and endpoint.

@newt you said: "but I think the biggest pull is coming from constantly randomizing noise." My second question is now, is it too cpu/gpu intensive? Would be a shame, cuz it looks awesome.zyblade2012-05-28 14:07:07
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Mon May 28, 2012 4:46 pm

A few things about the original example and splines: They are much more than curves. In fact they are ideal partners for such effects. Because you control the bendiness of the segments of a spline. They can be straight lines as well as a whole circle, they keep connected to each other, etc. The randomness is created with 2 perlin noise generators that are re-seeded on every tick in the flash example.

The problem is just, that splines are much easier done in a script language like AS3 or Python than in an event-based system.

The rest of the flash example is realized with effects, that you can use in CC as well, namely 'additive', 'horizontal blur' and 'vertical blur' and 'behind glow'
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon May 28, 2012 6:19 pm

Is there a way to combine oppenheimers example with newts first one?
I mean, there were 2 points the bolt was connected, both could be moved.
Or isn't that possible with that technique?
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

PreviousNext

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests