particle editor

For questions about using Classic.

Post » Sat Nov 12, 2011 7:54 am

Omg. I should start to math all over again.

"RGB(clamp(lerp(GetRed(particle('fadetoColor')), GetRed(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetGreen(particle('fadetoColor')), GetGreen(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetBlue(particle('fadetoColor')), GetBlue(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255))"


What are you talking about. How did you calculate it :). lerp inside of clamp. Sin, cos, tan. I wish I had listened my math teacher on my collage years.

Thank you for sharing.
B
7
S
1
G
1
Posts: 76
Reputation: 904

Post » Sat Nov 12, 2011 11:58 am

At the end, it looks more complicated as it was, when you tought it out . Can't find that simple sin/cos example so I made a new one. I named the variables how you have to set up the formula if you want to make something circles around^^(x + radius * cos(angle))

http://dl.dropbox.com/u/26932498/umkreisen.capzyblade2011-11-12 12:01:35
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Sat Nov 12, 2011 11:07 pm

[QUOTE=Spider_hip] Omg. I should start to math all over again.

"RGB(clamp(lerp(GetRed(particle('fadetoColor')), GetRed(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetGreen(particle('fadetoColor')), GetGreen(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255), clamp(lerp(GetBlue(particle('fadetoColor')), GetBlue(particle('fadefromColor')), particle('currentcolortime') / particle('colorfadetime')), 0, 255))"


What are you talking about. How did you calculate it :). lerp inside of clamp. Sin, cos, tan. I wish I had listened my math teacher on my collage years.

Thank you for sharing.[/QUOTE]

You're welcome :)

But don't get too afraid just of long phrases. It really is simple, as soon as you follow the logic behind it.
The values of the three color channels are linearily interpolated, so that all three change in the same amount of time. This is what lerp is for. The t-value of lerp ist calculated as a ratio of the total time given to interpolate and the actual time.
Clamp just serves one purpose: timedelta is constantly substracted from currentcolortime, and so can get negative, which would make the t-value negative also, and the color would continue to change (but in an unwanted way). Something was needed to prevent that the color value will get negative and clamp is one way of doing so. You could also just use max(formula, 0).

The fun of sin and cos is that they are so easy to use. Just give it an angle and it tells you a position, I love it ;)
And when used to animate something it also has some kind of built-in deceleration/acceleration. I did go into detail somewhere else, so I won't repeat it, but if you could only learn and use two functions, I'd say go with sin and cos. What you can realize with only those is so versatile.tulamide2011-11-12 23:08:53
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests