PDA

View Full Version : Fade to Color- Transitional effects


Kymberlee
02-12-2009, 02:13 PM
I apologize if this has been asked/answered. I am going through the book "Alice in Action" and at the end of chapter 6 it discusses transitional effects, such as fade to black, where you set a "number" parameter so the user can choose how long the fade to black should take. One of the assignments asks that you do a similar thing, only fade to "someColor"... and this is where I am not sure what to do.
When I need to do anything asking a user to input a number, such as time or distance, I use a number parameter... but what kind of parameter do I use for a color choice? Not object- then the user needs to pick an object. Not a string, then the user has to type in a string... I am lost.:confused:
I hope this makes sense, and I'm sorry if it's a dumb question- I'm new to this, and can't seem to figure it out.

Mojax
02-12-2009, 04:59 PM
Looking into this, I see that the shutters they use to achieve the fading are just the Square object. So if you create your method, then create a parameter, you'll notice that if you select other, one of the options in the drop down box should be color. Then you can drag in the "color=" from the Square's properties tab, and then drop the parameter in place of the selected color. Then you just need to figure out how to have the user select what color they want. That part I'm still looking into.:D

Mojax
02-12-2009, 05:23 PM
Ok, the way I did it was thusly. I created a world variable as a list of colors. So create new variable under the properties tab of world, choose other:color then check off list. Then add the colors in. Now all the colors have an "index" value in the list. So in your method for setting the color, make the parameter a number. Then you can use the "NumberDialogue(question)" for it's value to ask the user for a number of the color they want. This then gets passed to the "color=(parameter)" statement, and voila! Hope this made sense. Since I'm actually in your class (this is Jeff :D) you can ask me about it if you see me.
EDIT: figured out you could attach files, so I've included an example file that shows what I mean.

Kymberlee
02-16-2009, 11:43 AM
Thank you!!!
You ROCK.
I'm seeew dumb sometimes. Thanks for not pointing out the obvious.;)