| |
|
|
p.specht
|
Windowtitle "Gummiband-Pendel in the Wind"'(CL)CopyLeft 2014-03 by P.woodpecker, Wien
Windowstyle 24:Window 0,0-%maxx,%maxy-40' No however geartete Gewähr!
randomize:var col&=rgb(200+rnd(56),200+rnd(56),200+rnd(56))
var xx&=width(%hwnd):var yy&=height(%hwnd):var xh!=xx&/2:var yh!=yy&/2:var zoom!=2000
declare x!,y!,dx!,dy!,mx!,my!,r!,fk!,m!,f!,fx!,fy!,w!,a!,ax!,ay!,v!,vx!,vy!,g!,t!,wind!
g! =9.80665'm/s²
fk!=0.3'zoom*n/m
t! =0.01'Zeitschritt
m! =4.8'kg
MCls xx&,yy&
REPEAT
StartPaint -1:ClS col&
print Fx!:print Fy!
usepen 0,1,0 : line xh!,0 - xh!,yy& : line 0,yh! - xx&,yh!
usepen 0,3,0 : line %mousex,%mousey - xh!+x!*zoom!,yh!-y!*zoom!
usepen 0,20,$9F0000 : line %mousex,%mousey - %mousex-1,%mousey
usepen 0,47,200 : line xh!+x!*zoom!,(yh!-y!*zoom!-1) - xh!+x!*zoom!,yh!-y!*zoom!
EndPaint
MCopyBMP 0,0-xx&,yy& > 0,0;0
mx!=%mousex-xh!-x!*zoom! : my!=yh!-%mousey-y!*zoom!
dx!=mx!-x! : dy!=my!-y!
Fx!=dx!*fk! : Fy!=dy!*fk!
ax!=Fx!/m! : ay!=Fy!/m! - g!'Gravitation
wind!=(rnd(90)-rnd(70))/zoom!
vx!=vx!+.5*ax!*t!+wind! : vy!=vy!+0.5*ay!*t!
vx!=vx!*0.97 : vy!=vy!*0.97
x!=x!+vx!*t!: y!=y!+vy!*t!
waitinput 4
UNTIL %key=27
end
|
|
|
| XProfan 11Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/11/21 ▲ |
|
|
|