by Tuğrul Yazar | July 16, 2012 00:14
This is probably the most simple definition on this site but I think it’s very useful. The timer is a special component of Grasshopper that is significant in terms of the real-time sketching paradigm. This basic use of a timer includes a 1-second update to a Vb script. Inside the script, the system date’s seconds are returned, so we see a real-time increasing number at output A. Beyond this point, It’s up to your imagination, how you can use that number.
When I was a kid, we used to write programs in Basic language using a similar method. For next loops seem to be useful in creating time gaps, telling the computer to “wait” for a couple of seconds. But later we discovered that the time computer waits in an empty for the next loop depends on the speed of the CPU, and decreased dramatically in the new Pentium 300s! So it was then a better idea to tell the computer exactly to wait for x seconds using system date and time parameters. This definition reminded me of those old days.
Here is the file containing the VB script and a working timer that counts and outputs seconds in real time. [GHX: 0.8.0066][1] (right click and save it to your computer, don’t left click). I’ve found the “Second” and “Now” statements here if you want to improve them further for your purposes.
In fact, my real motivation for getting into Timer lies in creating a metronome. This is for my future project of musical integration.
Note: If you want to have a faster chronometer, try setting the timer component to a lower value. Replace the line at the VB component with this: A = System.DateTime.Now.Millisecond
Source URL: https://www.designcoding.net/basic-use-of-timer-component/
Copyright ©2024 designcoding unless otherwise noted.