Marc
Nombre de messages : 2466 Age : 63 Localisation : TOURS (37) Date d'inscription : 17/03/2014
| Sujet: Illusion de Zöllner Dim 26 Fév 2017 - 21:07 | |
| Illusion de Zöllner. - Code:
-
' ------------------------------------------------------------------------------ ' Effet d'optique 2 : Les lignes obliques sont-elles parallèles ? ' Marc37 - Février 2017 - Panoramic v0.9.27 ' http://panoramic-language.pagesperso-orange.fr/French/index.html ' ------------------------------------------------------------------------------ WIDTH 0,500 HEIGHT 0, 552 LABEL Action,Quitter DIM v%,w%,h%,x%,y% h% = HEIGHT_CLIENT(0) w% = WIDTH_CLIENT(0) ON_CLOSE 0, Quitter Dessin() ON_CLICK 1, Action END ' ------------------------------------------------------------------------------ Action: x% = MOUSE_X_POSITION(1) y% = MOUSE_Y_POSITION(1) IF y%>460 AND y%<500 IF x%>70 AND x%<240 THEN Verification() IF x%>242 AND x%<410 THEN GOSUB Quitter END_IF RETURN ' ------------------------------------------------------------------------------ SUB Verification() IF v% =1 SPRITE_SHOW 2 v%=0 ELSE v%=1 SPRITE_HIDE 2 END_IF END_SUB ' ------------------------------------------------------------------------------ SUB Dessin() PICTURE 1 FULL_SPACE 1 2D_TARGET_IS 1 2D_PEN_WIDTH 4 Calque1() Calque2() SCENE2D 2 WIDTH 2,400 HEIGHT 2,400 LEFT 2,(w%-400)/2 TOP 2,(w%-400)/2 Boutons() COLOR 2,250,250,250 SPRITE 1 SPRITE_IMAGE_LOAD 1,10 SPRITE 2 SPRITE_IMAGE_LOAD 2,11 END_SUB ' ------------------------------------------------------------------------------ SUB Calque1() DIM_LOCAL i%,x1%,y1%,x2%,y2% COLOR 1,50,200,50 2D_PEN_COLOR 1,1,1 x1%= 0: y1%=100 x2%=100:y2%=0 FOR i% = 1 to 7 2D_LINE x1%,y1%,x2%,y2% y1%=y1%+100 x2%=x2%+100 NEXT i% IMAGE 10 2D_IMAGE_COPY 10,0,0,400,400 CLS END_SUB ' ------------------------------------------------------------------------------ SUB Calque2() DIM_LOCAL i%,j%,x1%,y1%,x2%,y2%,a% COLOR 1,0,0,0 2D_PEN_COLOR 1,1,1 a%=200 FOR j% = 0 to 3 x1%=20:y1%=60+(a%*j%) X2%=20:Y2%=100+(a%*j%) FOR i%=1 TO 20 2D_LINE x1%,y1%,x2%,y2% x1%=x1%+20 y1%=y1%-20 X2%=x2%+20 Y2%=y2%-20 NEXT i% NEXT j% FOR j% = 0 to 2 x1%=10:y1%=170+(a%*j%) X2%=50:Y2%=170+(a%*j%) FOR i%=1 TO 20 2D_LINE x1%,y1%,x2%,y2% x1%=x1%+20 y1%=y1%-20 X2%=x2%+20 Y2%=y2%-20 NEXT i% NEXT j% IMAGE 11 2D_IMAGE_COPY 11,0,0,400,400 CLS END_SUB ' ------------------------------------------------------------------------------ SUB Boutons() 2D_PEN_COLOR 150,150,150 2D_FILL_COLOR 150,150,150 2D_RECTANGLE 70,460,410,500 2D_PEN_WIDTH 2 2D_PEN_COLOR 1,1,1 2D_LINE 240,460,240,500 FONT_NAME 1,"Arial" FONT_SIZE 1, 20 PRINT_TARGET_IS 1 PRINT_LOCATE 90,465 PRINT "Vérification" PRINT_LOCATE 280,465 PRINT "Quitter" END_SUB ' ------------------------------------------------------------------------------ Quitter: TERMINATE RETURN | |
|