REM rotating squares
REM iPhone 6 Plus Tested
init:
graphics
rem
graphics clear 0,0,0
s=160
x1=100
y1=100
x2=100
y2=-100
x3=-100
y3=-100
x4=-100
y4=100
loop:
sq=rnd(.10) 'sequence in pattern
graphics clear 0,0,0
for r=0 to 3000
rr=r*sq
cc=cos(rr)
ss=sin(rr)
x11=x1*cc-y1*ss
y11=x1*ss+y1*cc
x11=x11+s
y11=y11+s
x22=x2*cc-y2*ss
y22=x2*ss+y2*cc
x22=x22+s
y22=y22+s
x33=x3*cc-y3*ss
y33=x3*ss+y3*cc
x33=x33+s
y33=y33+s
x44=x4*cc-y4*ss
y44=x4*ss+y4*cc
x44=x44+s
y44=y44+s
c=rnd(.255)
draw size 3
draw color 1,c,c
draw line x11,y11 to x22,y22
draw size 2
draw color c,1,c
draw line to x33,y33
draw size 1
draw color c,c,1
draw line to x44,y44
draw line to x11,y11
NEXT r
goto loop
Rotating Squares pattern
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Rotating Squares pattern
- Attachments
-
- Testing this basic out...
- image.jpg (325.18 KiB) Viewed 4480 times
Last edited by DrChip on Wed Dec 24, 2014 9:31 am, edited 1 time in total.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Rotating Squares pattern
Great!
I can suggest this modification:
I can suggest this modification:
Code: Select all
REM rotating squares
REM iPhone 6 Plus Tested
init:
graphics
rem
graphics clear 0,0,0
s=160
x1=100
y1=100
x2=100
y2=-100
x3=-100
y3=-100
x4=-100
y4=100
refresh off
shadow on
loop:
graphics clear 0,0,0
for r=0 to 3000
rr=r*.3 'sequence in pattern
cc=cos(rr)
ss=sin(rr)
x11=x1*cc-y1*ss
y11=x1*ss+y1*cc
x11=x11+s
y11=y11+s
x22=x2*cc-y2*ss
y22=x2*ss+y2*cc
x22=x22+s
y22=y22+s
x33=x3*cc-y3*ss
y33=x3*ss+y3*cc
x33=x33+s
y33=y33+s
x44=x4*cc-y4*ss
y44=x4*ss+y4*cc
x44=x44+s
y44=y44+s
c=rnd(.255)
draw size 3
draw color 1,c,c
draw line x11,y11 to x22,y22
draw size 2
draw color c,1,c
draw line to x33,y33
draw size 1
draw color c,c,1
draw line to x44,y44
draw line to x11,y11
refresh
NEXT r
goto loop
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Rotating Squares pattern
I forgot the random sequence for the patern. I updated the code, it looks a bit better. Thanks!
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
Re: Rotating Squares pattern
Nice! May i suggest the following init: part to make it hardware independent
Code: Select all
init:
graphics
rem
graphics clear 0,0,0
sw=screen_width() ! s=sw/2 ! d=sw/3
x1=d
y1=d
x2=d
y2=-d
x3=-d
y3=-d
x4=-d
y4=d
Re: Rotating Squares pattern
To make orientation independent..
init:
graphics
rem
graphics clear 0,0,0
get orientation p
if p=2 or p=3 then ! sw=screen_height() ! else ! sw=screen_width() ! end if
s=sw/2 ! d=sw/3
Etc.
init:
graphics
rem
graphics clear 0,0,0
get orientation p
if p=2 or p=3 then ! sw=screen_height() ! else ! sw=screen_width() ! end if
s=sw/2 ! d=sw/3
Etc.
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
Re: Rotating Squares pattern
Just a tiny detail:smbstarv wrote:To make orientation independent..
init:
graphics
rem
graphics clear 0,0,0
get orientation p
if p=2 or p=3 then ! sw=screen_height() ! else ! sw=screen_width() ! end if
s=sw/2 ! d=sw/3
Etc.
if p=2 or p=3 then sw=screen_height() else sw=screen_width()
is a valid statement, no need for the multi-statement exclamation marks
s
-
- Posts: 167
- Joined: Wed Oct 22, 2014 3:26 pm
- My devices: iPhone 4 to 6+,iPad mini to iPad air 2
Re: Rotating Squares pattern
REM rotating squares v2
REM iPhone 6 Plus Tested
REM v2 - tweaked colors
init:
graphics
rem
graphics clear 0,0,0
sw=screen_width()
sh=screen_height()
s1=sw/2
s2=sh/2
x1=200
y1=200
x2=200
y2=-100
x3=-200
y3=-100
x4=-100
y4=1
'refresh off
'shadow on
loop:
sq=rnd(.10) 'sequence in pattern
graphics clear 0,0,0
for r=0 to 3000
rr=r*sq
cc=cos(rr)
ss=sin(rr)
x11=x1*cc-y1*ss
y11=x1*ss+y1*cc
x11=x11+s1
y11=y11+s2
x22=x2*cc-y2*ss
y22=x2*ss+y2*cc
x22=x22+s1
y22=y22+s2
x33=x3*cc-y3*ss
y33=x3*ss+y3*cc
x33=x33+s1
y33=y33+s2
x44=x4*cc-y4*ss
y44=x4*ss+y4*cc
x44=x44+s1
y44=y44+s2
c=rnd(.255)
draw size 1
draw color 1,c,c
draw line x11,y11 to x22,y22
draw size 1
draw color c,1,c
draw line to x33,y33
draw size 1
draw color c,c,1
draw line to x44,y44
draw size 1
draw color c,c,c
draw line to x11,y11
'refresh
NEXT r
goto loop
REM iPhone 6 Plus Tested
REM v2 - tweaked colors
init:
graphics
rem
graphics clear 0,0,0
sw=screen_width()
sh=screen_height()
s1=sw/2
s2=sh/2
x1=200
y1=200
x2=200
y2=-100
x3=-200
y3=-100
x4=-100
y4=1
'refresh off
'shadow on
loop:
sq=rnd(.10) 'sequence in pattern
graphics clear 0,0,0
for r=0 to 3000
rr=r*sq
cc=cos(rr)
ss=sin(rr)
x11=x1*cc-y1*ss
y11=x1*ss+y1*cc
x11=x11+s1
y11=y11+s2
x22=x2*cc-y2*ss
y22=x2*ss+y2*cc
x22=x22+s1
y22=y22+s2
x33=x3*cc-y3*ss
y33=x3*ss+y3*cc
x33=x33+s1
y33=y33+s2
x44=x4*cc-y4*ss
y44=x4*ss+y4*cc
x44=x44+s1
y44=y44+s2
c=rnd(.255)
draw size 1
draw color 1,c,c
draw line x11,y11 to x22,y22
draw size 1
draw color c,1,c
draw line to x33,y33
draw size 1
draw color c,c,1
draw line to x44,y44
draw size 1
draw color c,c,c
draw line to x11,y11
'refresh
NEXT r
goto loop
- Attachments
-
- image.jpg (1.19 MiB) Viewed 4448 times
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Rotating Squares pattern
Ok, my modification:
Code: Select all
REM rotating squares v2
REM iPhone 6 Plus Tested
REM v2 - tweaked colors
graphics
sw=screen_width()
sh=screen_height()
s1=sw/2
s2=sh/2
x1=200
y1=200
x2=200
y2=-100
x3=-200
y3=-100
x4=-100
y4=1
refresh off
shadow on
sq=.5'rnd(1) 'sequence in pattern
draw size 3
loop:
r+=1
rr=r*sq
cc=cos(rr)
ss=sin(rr)
x11=x1*cc-y1*ss
y11=x1*ss+y1*cc
x11+=s1
y11+=s2
x22=x2*cc-y2*ss
y22=x2*ss+y2*cc
x22+=s1
y22+=s2
x33=x3*cc-y3*ss
y33=x3*ss+y3*cc
x33+=s1
y33+=s2
x44=x4*cc-y4*ss
y44=x4*ss+y4*cc
x44+=s1
y44+=s2
c=rnd(.25)
draw alpha rnd(1)+.5
draw color 1,c,c
draw line x11,y11 to x22,y22
draw alpha rnd(1)+.5
draw color c,1,c
draw line to x33,y33
draw alpha rnd(1)+.5
draw color c,c,1
draw line to x44,y44
draw alpha rnd(1)+.5
draw color c,c,c
draw line to x11,y11
refresh
goto loop