This shows you the differences between two versions of the page.
graphicsimagejmrmob [2016/01/01 22:37] |
graphicsimagejmrmob [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | {{jmreneau_mobius.png? | ||
+ | Animated mobius strip (July 2010) | ||
+ | < | ||
+ | # mobius.kbs | ||
+ | # rotation mobius strip - j.m.reneau | ||
+ | fastgraphics | ||
+ | dim p(8) | ||
+ | dim c(3) | ||
+ | c = {red, green, blue} | ||
+ | w = .20 # width of strip | ||
+ | dr = 2 * pi / 100 # size of rotation in frame | ||
+ | speed = .01 # pause between frames | ||
+ | r = 0 | ||
+ | while true | ||
+ | clg | ||
+ | for t = 0 to 2 | ||
+ | x = sin((t - w) * pi * 2 / 3 + r)*graphwidth/ | ||
+ | y = cos((t - w) * pi * 2 / 3 + r)*graphheight/ | ||
+ | x1 = sin((t + w) * pi * 2 / 3 + r)*graphwidth/ | ||
+ | y1 = cos((t + w) * pi * 2 / 3 + r)*graphheight/ | ||
+ | x2 = sin((t+1 - w) * pi * 2 / 3 + r)*graphwidth/ | ||
+ | y2 = cos((t+1 - w) * pi * 2 / 3 + r)*graphheight/ | ||
+ | x3 = sin((t+1 + w) * pi * 2 / 3 + r)*graphwidth/ | ||
+ | y3 = cos((t+1 + w) * pi * 2 / 3+ r)*graphheight/ | ||
+ | p = {x, | ||
+ | color c[t] | ||
+ | poly p | ||
+ | next t | ||
+ | | ||
+ | r = r + dr | ||
+ | pause speed | ||
+ | end while | ||
+ | </ | ||