How to start draw other shapes after press key 'k' in openframeworks

I created a project, that after ten times press key ‘k’, the canvas will draw a circle, how to realize this movement?
Thanks very much!

Make a variable called counter and set it to 0 in the setup.

In void ofApp::keyReleased(int key) do:

if(key == 'k'){

And in your draw you can do

if(counter >=10){

Of course, this is a very basic implementation, depends on what exactly you’re trying to do…

1 Like

thanks very much!