We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everybody,
I am starting with processing and I am a bit lost. I would like to display some text in a defined rectangle and then, following the order of reading (upper left corner to bottom right corner), make each letter move randomly, as the same time as lowering its opacity until total dissapearing. I suppose it's possible but I have no idea wich function I should use !
Thank you very much for your help ! :)
Answers
You can use text with 5 parameters for the rectangular box
BUT that won’t help you with the opacity thing.
Here you would have a class Letter
with char, Position x,y and opacity degree and move direction: xadd , yadd
Then an ArrayList of that class
Do the tutorial objects please
Best, Chrisir ;-)
Also maybe a kind of timer / startTime so that they start one after another
TIMer starts a Boolean variable isActivated
When it’s true, letter starts moving and getting darker
You will have to write your own function -- or your own class with methods.
If you do not want to write a Letter class and create an array of Letter[] letters, then you will need to use parallel arrays. The only reason to consider doing that is that many of your variables are all derived in principle, so you don't need to store them. All you need is:
This approach isn't necessarily easier to program, but it might be a bit easier to e.g. play backwards (letters fade in), scrub with the mouse, dynamically generate for different string lengths, etc. However as soon as you start adding many more properties (like one color per letter, or one size per letter, etc.) then you will start wishing for the Class / Object approach.
P.S. -- actually, you could probably get rid of the random headings list too if you just use assign spinning headings -- e.g. 1, 2, 3, 4 radians.
Here are some quick, rough examples of the functional approach, with no classes, objects, or per-letter variables -- just a string, and that's it.
Thank you everybody for your help ! I got close to what I was looking for ! :) Your comments were very helpful !