Fade in/out image dosent work :/
Generally I wanted to do something easy, there's actor who called section that display an image.
The image visible starter is false.
Every time you click this actor(section) I need it to fade in and be visible(=true) and after 0.4 sec fade out and visible false.. Any ideas?
Comments
Quick demo attached that can be changed to suit.
Darren.
When actor is touched - interpolate alpha to 1.1
Timer, after 0.4 seconds - interpolate alpha to -0.1
What is this over and under the value magic?
As @matarua said, magic numbers?
Why 1.1 instead of 1, and why -0.1 and not 0.
Intrigued..
I am guessing it is due to the interpolation bug that jumps the last 10% in an un-smooth way, so by interpolating past that 10% you go in to the out of range value for the bad jumpy bit but it stays smooth while actually interpolating the real alpha value, is that the idea @Socks ?
hey, this mite help you out, iv got a video about this over at gsinvention
http://www.gsinvention.com/tutorials
Two things to consider, firstly there is no such thing as an alpha value of -0.1 or 1.1, and secondly GameSalad's interpolate algorithm is broken - it chops off the last 10% of the last whole number of its target interpolation value.
This is unnoticeable when you are moving an actor from x 40 to x 846 as you're not going to notice the fact that the actor actually only moved across 90% of the distance from 845 to 846 and skipped the last 10% of the last pixel arriving (if my maths is correct) 0.012% early.
Imperceivable stuff.
But now let's zoom right in on the problem area, let's interpolate from 0 to 1, your target interpolation value now arrives 10% early, which is very noticeable.
This is what the final moments of our 0 to 1 interpolation should look like . . . (rounded to 1 decimal place) . . .
7.8
7.9
8.0
8.1
8.2
8.3
8.5
8.6
8.7
8.8
8.9
9.0
9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
9.9
1.0
. . . but this is what it actually does . . .
7.8
7.9
8.0
8.1
8.2
8.3
8.5
8.6
8.7
8.8
8.9
9.0
1.0
1.0
1.0
1.0
1.0
1.0
. . . etc, it skips all the values between 9.0 and 9.9.
What does all this pedantry mean to GameSalad users ? When you are fading actors (or scenes or menus or whatever) in and out there is a little glitch on the end of the fade which ruins your nice smooth fades - when things fade in they fade nicely from nothing to 90% opacity and then 'pop' up to 100%, the same deal on the way down, nice smooth fade then at 10% they 'pop' off the screen ruining your fade.
It's the same deal with sound as the problem is coming from the interpolation behaviour - and with sound you also fade over small values (0 to 1 and 1 to 0).
So . . . . the fix . . . push the faulty maths outside of the range of the thing you are interpolating, like I say there is no such thing as an alpha value of -0.1 or an audio level of 1.1 so interpolating to these values effectively clips off the faulty maths - the interpolation is waiting to get to the last 10% of the last whole number to do its evil . . . but before it can commit its crime your alpha/sound has already hit 0/1.
tl;dr
Choppy choppy bad make nice.
Exactly !
@Socks the way I have done this in the past where Alpha limitations were not an option - this was my way around it - interpolate a larger number and times that equation by the result you want.
So you do the interpolating number from 1 to 100 but you times it by .1 if you were doing Alpha for example.
I think that also solved it - can't find where I did that tho
Yep, that's a method I use sometimes too, also if you want the dampening (ease in and/or ease out) you can do this.
Interpolate attribute-'fade' from 0 to 256 (set your dampening).
Constrain alpha to 'fade'/256
Yep that's what I do - only if I need to and the stock one has issues, 0 to 1 is worse than 1 to 0. The Alpha one is a nice cheap trick tho, cheers
...> @matarua said:
Yeah, for most things just sticking that extra 0.1 on to the target value does the trick.
Although obviously this will screw up any dampening you might want to use !
Also if the arrival time of your interpolation is important you will want to adjust the time setting to compensate for the extended interpolation target.
A lazy way to approach this is to just double your values.
Interpolate α from 0 to 1 / 10 seconds = a 10" interpolation to 1 with clipped end.
Interpolate α from 0 to 2 / 20 seconds = a 10" interpolation to 1 with no clipped end.
@Socks as I have said before there are those who do wonders within bounds and those who wonder within bounds - I think the limitations of the Sinclair Spectrum taught me that. Thanks for keeping that dream alive.
Haha, that's the spirit. How much would one of those be worth now?
Not much !
http://www.ebay.co.uk/itm/Sinclair-C5-/321347412759