I was working on figuring out while loops for an exercise in LearnJavaScriptTheHardWay by Zed Shaw, and I decided to do this: The red text console.logs were for debugging, and will take over the animation if the comments are removed. The bold red number is the point at which the loop stops. My CPU didn't have too much trouble with that large number, but I'd recommend dialing it down if your CPU is slow. Also if your CPU is really fast, you'll have to change the pause to something much lower to see the animation better. That too is in a loop, so the more that pause happens, the more loops your CPU is running. Link: https://stackoverflow.com/questions/9006988/node-js-on-windows-how-to-clear-console To clear screen as described in link above, uncomment the bold purple comment I tried to comment the code to help learners see what I did, any comments or suggestions, feel free to drop em in! ex16_ASCII.js //Trying to make a comma
Ok I am so far from understanding, so don't take this as any kind of math lesson. Also, every time I thought I knew what I was doing.... pygame would show me differently. Still a work in progress, but for now, something to play with. Update: SinWaveTime class added to produce that particular weaving effect Tinkering with the different sin wave variables: I wrote this piece separate from my 3D experiment to see how to manipulate the sin wave. While trying to use time as the factor to move my pygame draw circle on the x-axis, i got this crazy little doo-dad : I don't think it's drawing two circles at once, but if I figure out what the heck it's doing I'll let you know. Or hey if you know, drop a comment. I don't know if my comments are just not working, or no one wants to. So, here's some pygame code to play with the sin wave. Alter the different variables to see it in action. picture of SinWave.move_with_time() see changes, SinWaveTime c
Here's a bit I'm working on. I've discovered I love doing Ascii. Examples of how to use the color changing escape. I got a table from StackOverflow: https://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python the charts are way at the bottom. So far accurate for me. def prettyjunk ( self ): # 1 is bold, 0 is plain, 2 is dull text_red = ' \x1b [1;31;40m' stop_color = ' \x1b [0m' text_blue = ' \x1b [1;34;40m' text_green = ' \x1b [1;32;40m' text_purple = ' \x1b [1;35;40m' text_lightblue = ' \x1b [1;36;40m' text_white = ' \x1b [1;37;40m' a_green_at = ( f " { text_green } @ { stop_color } " ) a_red_at = ( f " { text_red } @ { stop_color } " ) print ( f " { text_red } This should be Red. { stop_color } " ) print ( f "
Comments
Post a Comment