Code archives/Graphics/Diagonal stripes
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Lord Year 2010, August 16, Monday Hi everybody, here is EsseEmmeErre tiping from Italy! :D What I am bringing to you is a simple BLITZ 3D code to generate diagonal stripes. This is the first working version I have made; the code could be improved but at the moment I would give you it as is. Sorry for the variable names that are in italian; I hope this may not discourage you to examine my simple code. HAVE FUN! :-D | |||||
;-> Strisce Diagonali by Stefano Maria Regattin ;i> Monday 16 August 2010 ;------------------------- AppTitle("Striscie diagonali by Stefano Maria Regattin") AltezzaFinestra=GraphicsHeight() LarghezzaFinestra=GraphicsWidth() LarghezzaStriscia=20 For YPunto=0 To AltezzaFinestra-1 For XPunto=0 To LarghezzaFinestra-1 Punto=XPunto+YPunto If Punto Mod LarghezzaStriscia=LarghezzaStriscia-1 Then If StrisciaGialla=False StrisciaGialla=True Else StrisciaGialla=False EndIf EndIf If StrisciaGialla=False Rosso=95:Verde=95:Blu=95 Else Rosso=191:Verde=191:Blu=0 EndIf Color(Rosso,Verde,Blu):Plot(XPunto,YPunto) Next If YPunto Mod LarghezzaStriscia=LarghezzaStriscia-1 Then If StrisciaGialla=False StrisciaGialla=True Else StrisciaGialla=False EndIf EndIf Next MouseWait() End |
Comments
| ||
Welcome Stefano. I had a go at translating this but I don't know what "Gialla" means :) AppTitle("Diagonal Stripes by Stefano Maria Regattin") WindowHeight=GraphicsHeight() WindowWidth=GraphicsWidth() StripeWidth=20 For YPoint=0 To WindowHeight-1 For XPoint=0 To WindowWidth-1 If (StripeGialla) Red=191: Green=191:Blue=0 Else Red=95: Green=95:Blue=95 End If Point=XPoint+YPoint StripeGialla= ((Point Mod StripeWidth)=(StripeWidth-1)) Color(Red,Green,Blue) Plot(XPoint,YPoint) Next StripeGialla=((YPoint Mod StripeWidth)=(StripeWidth-1)) Next MouseWait() End Anyway, I alswo made an effort to clean the code up a tad, I hope that it helps with the formatting! |
| ||
Lord Year 2010, August 17, Tuesday Hi, here is EsseEmmeErre tiping from Italy! :D Thank you Malice for your interest of my little code! :) Gialla is Yellow in italian, so the variable should be YellowStripe. :) THANK ALL YOU AND MANY WHISHES OF HAPPY HOLIDAYS TO EVERYBODY! :D |
| ||
Hi everybody, here is EsseEmmeErre from Italy! :) I have correpted my little code, now should be better. MANY GREETINGS FROM ITALY! :D ;-> Diagonal Stripes by EsseEmmeErre ;i> Monday 16 August 2010 ;m> 14 Sep 2010 ;m> 2 Oct 2010 ;-------------- AppTitle("Diagonal Stripes by EsseEmmeErre") WindowHeight=GraphicsHeight() WindowWidth=GraphicsWidth() StripeWidth=20 For YPoint=0 To WindowHeight-1 For XPoint=0 To WindowWidth-1 Point=XPoint+YPoint If Point Mod StripeWidth=0 Then If YellowStripe=False YellowStripe=True Else YellowStripe=False EndIf EndIf If YellowStripe=False Red=95:Green=95:Blue=95 Else Red=191:Green=191:Blue=0 EndIf Color(Red,Green,Blue):Plot(XPoint,YPoint) Next If Point Mod StripeWidth=0 Then If YellowStripe=False YellowStripe=True Else YellowStripe=False EndIf EndIf Next MouseWait() End |
| ||
Heya all here is it, easy to use, cleaned up and a little bit faster :) |
| ||
Lord Year 2010, October 19, Tuesday Hi to all here, I must let you know that my last code here is buggy. :( The bug is at start when XPoint and YPoint are 0, that is Point=0 also, so the line [Point Mod StripeWidth=0] gives 0 and so the first stripes is changed here! :( My apologies to all the coders here that I know will bring here a solution for the bug. :) HAPPY CODING AND GREETINGS FROM ITALY! |
| ||
Lord Year 2010, October 20, Wednesday Hi here, I am EsseEmmeErre again! :-D Here is the bug free version of this code; enjoy using it! :-) GOOD CODING AND MANY GREETINGS FROM ITALY TO ALL YOU! :-D ;-> Diagonal Stripes by EsseEmmeErre ;i> Monday 16 August 2010 ;m> 14 Sep 2010 ;m> 2,20 Oct 2010 ;------------------ AppTitle("Diagonal Stripes by EsseEmmeErre") StripeWidth=20 WindowHeight=GraphicsHeight() WindowWidth=GraphicsWidth() For YPoint=0 To WindowHeight-1 For XPoint=0 To WindowWidth-1 Point=XPoint+YPoint If Point>0 And Point Mod StripeWidth=0 Then If YellowStripe=False YellowStripe=True Else YellowStripe=False EndIf EndIf If YellowStripe=False Red=95:Green=95:Blue=95 Else Red=191:Green=191:Blue=0 EndIf Color(Red,Green,Blue):Plot(XPoint,YPoint) Next If Point Mod StripeWidth=0 Then If YellowStripe=False YellowStripe=True Else YellowStripe=False EndIf EndIf Next MouseWait() End |
| ||
Lord Year 2011, April 27, Wednesday Hi here to all you, I have found a bug into my previous code: if the width or the height of the graphics area for the stripes are not divisble by the stripes size, you will get some nasty unpredictable drawing instead of the stripe! :( The followin code should be the solution for this problem. ;-> DiagonalStripes2 by EsseEmmeErre ;d> Wednesday 27th April 2011 from StrisceDiagonali ;--------------------------------------------------- AppTitle("StrisceDiagonali2","Would you leave?") StripesWidth=20 For YPoint=0 To GraphicsHeight()-1 For XPoint=0 To GraphicsWidth()-1 Point=(XPoint+YPoint)/StripesWidth Mod 2 If Point=0 Then YellowStripe=True Else YellowStripe=False EndIf If YellowStripe=False Red=95:Green=95:Blue=95 Else Red=191:Green=191:Blue=0 EndIf Color(Red,Green,Blue):Plot(XPoint,YPoint) Next Next Color(255,255,255) Write("Press a mouse button to leave...") MouseWait() End |
| ||
Aha, I see we're getting into the mathematical art zone. [ screenshot of Diagonal stripes by EsseEmmeErre ] |
Code Archives Forum