@GoToLoop thank you that was helpful I am a beginner so will try and do what you said, I know what Ifs and elses do, but what do you mean when you say
"Use if/else if block or a switch/case block:"
noLoop() is for when we want draw() to be called once for each redraw().
If your app needs to animate things while waiting for user input, it can't use noLoop()/redraw() approach! :-S
If you haven't done contrast() yet, just leave it empty or remove it completely from the constants.
... also why do I need case CONTRAST and void contrast, ...
CONTRAST is a constant int variable. While contrast() is a function (a.K.a. method).
Just made them as separate functions for organization purpose, so the switch/case block is left uncluttered.
And are you sure you don't wanna try out noLoop()/redraw() approach?
It's much simpler than leaving auto draw() callback. B-)
Up till now I thought the states changed only after a user pressed space key.
But now you're saying it is frameCount based!
Although I don't grasp exactly what you mean by each 20 frames.
Is it about changing current effect state after 20 seconds? :-/
1 last thing: Are those effects dynamic or static? That is: gradual or at once?
Definitely it's not noLoop()/redraw() approach!
But again, what do you mean by 20 frames? By default, draw() is called @ 60 FPS.
20 frames would be merely 1/3 of a second! $-)
If you wanna bind the whole animation to 20 frames, store current frameCount at the animation's start.
While in draw(), check if it gets equal to stored value + 20. Issue noLoop() if so.
Of course, have loop() inside keyPressed() in order to re-ignite the animation.
Hi @GoToLoop !
Great coding! I have a question for you. When I use your code, but try to put in my own coding instead of filter(DILATE);, line 53, an error comes up.
"Cannot invoke setTitle(STRING) on the primitive type int"
Answers
It seems more like a case for app state approach: *-:)
,
http://forum.processing.org/two/discussion/8045/how-to-format-code-and-text
.
.
That was just a template. Inside draw(), check which state is current and do that task.
Use if/else if block or a switch/case block: :-B
@GoToLoop thank you that was helpful I am a beginner so will try and do what you said, I know what Ifs and elses do, but what do you mean when you say "Use if/else if block or a switch/case block:"
noLoop() is for when we want draw() to be called once for each redraw().
If your app needs to animate things while waiting for user input, it can't use noLoop()/redraw() approach! :-S
.
.
Hmm... Tweaked my template to use your wallpaper now.
Just add your contrast() & negative() code in those respective functions: O:-)
There's also Processing's filter() fx function: :D
https://processing.org/reference/filter_.html
.
.
And I've made a bug at the beginning of draw(): =P~
It's fixed now: :-\"
If you haven't done contrast() yet, just leave it empty or remove it completely from the constants.
CONTRAST is a constant
int
variable. While contrast() is a function (a.K.a. method).Just made them as separate functions for organization purpose, so the switch/case block is left uncluttered.
And are you sure you don't wanna try out noLoop()/redraw() approach?
It's much simpler than leaving auto draw() callback. B-)
.
Up till now I thought the states changed only after a user pressed space key.
But now you're saying it is frameCount based!
Although I don't grasp exactly what you mean by each 20 frames.
Is it about changing current effect state after 20 seconds? :-/
1 last thing: Are those effects dynamic or static? That is: gradual or at once?
.
Definitely it's not noLoop()/redraw() approach!
But again, what do you mean by 20 frames? By default, draw() is called @ 60 FPS.
20 frames would be merely 1/3 of a second! $-)
.
If you wanna bind the whole animation to 20 frames, store current frameCount at the animation's start.
While in draw(), check if it gets equal to stored value + 20. Issue noLoop() if so.
Of course, have loop() inside keyPressed() in order to re-ignite the animation.
.
.
Re-adjusted my template for latest knowledge. Using filter() just to have something to do:
Hi @GoToLoop ! Great coding! I have a question for you. When I use your code, but try to put in my own coding instead of filter(DILATE);, line 53, an error comes up. "Cannot invoke setTitle(STRING) on the primitive type int"
Any idea on how to fix this? Thank you :)
Convert it to a String w/ str() or by concatenating it w/ an empty
+ ""
one:https://processing.org/reference/strconvert_.html
Although I've got no idea how a code inside contrast() would affect the setTitle() at the top of draw(). :-/