Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Beginner needs help
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01088449
Message ID:
01089240
Views:
14
I always wondered what the difference between "Geometry" and "trigonometry". This guy - at certain speeds - has a funny effect!
* Mantra.PRG
* Cheap - much chaper!
* Speed set at 11. Click Join for merger
* Top 2 "globes" are trig (sine gernerated)
* Bottom globe is gemomteric linear - See the diff!
PUBLIC oform 
nTopOff=31
nBallWidth=200
nBallHeight=200
nBotTop=426
DIMENSION arVector[18,2] && degrees avd vector
* A 0 degree is full limb / face on 
* A 90 degree is edge on
* when the controlling degree is 0, reverse vecor
arVector[1,1]=0 && Move from full (0) to 90 (on edge)
arVector[1,2]=1 && Vector +1 / -1
arVector[2,1]=30
arVector[2,2]=1
arVector[3,1]=60
arVector[3,2]=1
arVector[4,1]=90
arVector[4,2]=1
arVector[5,1]=120
arVector[5,2]=1
arVector[6,1]=150
arVector[6,2]=1
arVector[7,1]=0
arVector[7,2]=1
arVector[8,1]=30
arVector[8,2]=1
arVector[9,1]=60
arVector[9,2]=1
arVector[10,1]=90
arVector[10,2]=1
arVector[11,1]=120
arVector[11,2]=1
arVector[12,1]=150
arVector[12,2]=1
arVector[13,2]=-1
arVector[14,2]=-1
arVector[15,2]=-1
arVector[16,2]=-1
arVector[17,2]=-1
arVector[18,2]=-1
nBlue=RGB(0,0,255)
nRed=RGB(255,0,0)
nGreen=RGB(0,255,0)
nWhite=RGB(255,255,255)
oform=CREATEOBJECT('theform')
WITH oform
.ADDOBJECT('cmdFormColor','theButton')
.cmdFormColor.CAPTION=[Back]
.cmdFormColor.left=41
.ADDOBJECT('cmdSplitBall','theButton')
.cmdSplitBall.CAPTION=[Join]
.cmdSplitBall.left=100
nTopOff=278
ENDWITH 
READ events
RELEASE ALL

DEFINE CLASS theBigBall as Shape
curvature=99 && 99
height=200
width=200
fillstyle=1
backstyle=0
left=0
top=22
visible=.t.
borderwidth=1
bordercolor=RGB(0,0,0)
ENDDEFINE 

DEFINE CLASS theform as Form
Caption=[Mantra]
minbutton=.f.
maxbutton=.f.
autocenter=.t.
borderstyle=1
width=200
height=636
*backcolor=RGB(245,245,245)
PROCEDURE init
this.visible=.t.
this.resize
this.t1.interval=11
ENDPROC 
PROCEDURE queryunload
CLEAR EVENTS
ENDPROC 
PROCEDURE resize
ENDPROC 
ADD OBJECT Ball1 as theBigBall
ball1.bordercolor=nWhite*(1/12)
ADD OBJECT Ball2 as theBigBall
ball2.bordercolor=nWhite*(2/12)
ADD OBJECT Ball3 as theBigBall
ball3.bordercolor=nWhite*(3/12)
ADD OBJECT Ball4 as theBigBall
ball4.bordercolor=nWhite*(4/12)
ADD OBJECT Ball5 as theBigBall
ball5.bordercolor=nWhite*(5/12)
ADD OBJECT Ball6 as theBigBall
ball6.bordercolor=nWhite*(6/12)
ADD OBJECT Ball7 as theBigBall
ball7.bordercolor=nWhite*(7/12)
ADD OBJECT Ball8 as theBigBall
ball8.bordercolor=nWhite*(8/12)
ADD OBJECT Ball9 as theBigBall
ball9.bordercolor=nWhite*(9/12)
ADD OBJECT Ball10 as theBigBall
ball10.bordercolor=nWhite*(10/12)
ADD OBJECT Ball11 as theBigBall
ball11.bordercolor=nWhite*(11/12)
ADD OBJECT Ball12 as theBigBall
ball12.bordercolor=nWhite*(12/12)
ADD OBJECT Ball13 as theBigBall
ball13.width=200
ADD OBJECT Ball14 as theBigBall
ball14.width=166
ADD OBJECT Ball15 as theBigBall
ball15.width=133
ADD OBJECT Ball16 as theBigBall
ball16.width=100
ADD OBJECT Ball17 as theBigBall
ball17.width=66
ADD OBJECT Ball18 as theBigBall
ball18.width=33
* Hidden ball (Rotating Coin)
ADD OBJECT Ball19 as theBigBall
ADD OBJECT Ball20 as theBigBall
ball19.Visible=.f.
ball19.top=224
ball20.Visible=.f.
ball20.top=224
ball13.top=nBotTop
ball14.top=nBotTop
ball15.top=nBotTop
ball16.top=nBotTop
ball17.top=nBotTop
ball18.top=nBotTop
ball1.fillstyle=4
ball10.fillstyle=5
ball13.fillstyle=6
ball13.fillcolor=12632256
ADD OBJECT t1 as theTimer
ADD OBJECT Rate as theSpinner
ADD OBJECT Curv as theSpinner
Curv.left=161
Curv.Value=99
ENDDEFINE 

DEFINE CLASS theTimer as Timer
interval=0
PROCEDURE timer
spinball(thisform)
ENDPROC 
ENDDEFINE 

PROCEDURE spinball(oform)
WITH oform
arVector[1,1]=arVector[1,1]+arVector[1,2]
arVector[2,1]=arVector[2,1]+arVector[2,2]
arVector[3,1]=arVector[3,1]+arVector[3,2]
arVector[4,1]=arVector[4,1]+arVector[4,2]
arVector[5,1]=arVector[5,1]+arVector[5,2]
arVector[6,1]=arVector[6,1]+arVector[6,2]
arVector[7,1]=arVector[7,1]+arVector[7,2]
arVector[8,1]=arVector[8,1]+arVector[8,2]
arVector[9,1]=arVector[9,1]+arVector[9,2]
arVector[10,1]=arVector[10,1]+arVector[10,2]
arVector[11,1]=arVector[11,1]+arVector[11,2]
arVector[12,1]=arVector[12,1]+arVector[12,2]
.ball1.height=nBallHeight*ABS(SIN(DTOR(arVector[1,1])))
.Ball1.top=((94-.Ball1.height)/2)+nTopOff
.ball1.fillcolor=arVector[1,1]*93200
.ball2.height=nBallHeight*ABS(SIN(DTOR(arVector[2,1])))
.Ball2.top=((94-.Ball2.height)/2)+nTopOff
.ball3.height=nBallHeight*ABS(SIN(DTOR(arVector[3,1])))
.Ball3.top=((94-.Ball3.height)/2)+nTopOff
.ball4.height=nBallHeight*ABS(SIN(DTOR(arVector[4,1])))
.Ball4.top=((94-.Ball4.height)/2)+nTopOff
.ball5.height=nBallHeight*ABS(SIN(DTOR(arVector[5,1])))
.Ball5.top=((94-.Ball5.height)/2)+nTopOff
.ball6.height=nBallHeight*ABS(SIN(DTOR(arVector[6,1])))
.Ball6.top=((94-.Ball6.height)/2)+nTopOff
.Ball7.width=nBallWidth*ABS(COS(DTOR(arVector[7,1])))
.Ball7.left=(.width-.Ball7.width)/2
.Ball8.width=nBallWidth*ABS(COS(DTOR(arVector[8,1])))
.Ball8.left=(.width-.Ball8.width)/2
.Ball9.width=nBallWidth*ABS(COS(DTOR(arVector[9,1])))
.Ball9.left=(.width-.Ball9.width)/2
.Ball10.width=nBallWidth*ABS(COS(DTOR(arVector[10,1])))
.Ball10.left=(.width-.Ball10.width)/2
.ball10.fillcolor=16777215-(arVector[1,1]*93000)
.Ball19.width=.Ball10.width
.Ball19.left=.Ball10.Left
STORE .Ball10.FillColor TO .ball19.fillcolor,.Ball20.FillColor
.ball20.height=.ball1.height
.ball20.top=((94-.Ball1.height)/2)+278
.Ball11.width=nBallWidth*ABS(COS(DTOR(arVector[11,1])))
.Ball11.left=(.width-.Ball11.width)/2
.Ball12.width=nBallWidth*ABS(COS(DTOR(arVector[12,1])))
.Ball12.left=(.width-.Ball12.width)/2
nDelta=arVector[1,2]
arVector[1,2]=getvector(1)
arVector[2,2]=getvector(2)
arVector[3,2]=getvector(3)
arVector[4,2]=getvector(4)
arVector[5,2]=getvector(5)
arVector[6,2]=getvector(6)
arVector[7,2]=getvector(7)
arVector[8,2]=getvector(8)
arVector[9,2]=getvector(9)
arVector[10,2]=getvector(10)
arVector[11,2]=getvector(11)
arVector[12,2]=getvector(12)
arVector[13,2]=getoscilate(.Ball13,13)
arVector[14,2]=getoscilate(.Ball14,14)
arVector[15,2]=getoscilate(.Ball15,15)
arVector[16,2]=getoscilate(.Ball16,16)
arVector[17,2]=getoscilate(.Ball17,17)
arVector[18,2]=getoscilate(.Ball18,18)
IF nDelta#arVector[1,2]
   .Ball1.fillstyle=IIF(.Ball1.fillstyle=4,5,4)
   .Ball10.fillstyle=IIF(.Ball10.fillstyle=4,5,4)
   .Ball19.fillstyle=.Ball10.fillstyle
   .Ball20.fillstyle=.Ball1.fillstyle
ELSE 
ENDIF 
.ball13.width=.ball13.width+arVector[13,2]
.ball13.left=(.width-.ball13.width)/2
.ball14.width=.ball14.width+arVector[14,2]
.ball14.left=(.width-.ball14.width)/2
.ball15.width=.ball15.width+arVector[15,2]
.ball15.left=(.width-.ball15.width)/2
.ball16.width=.ball16.width+arVector[16,2]
.ball16.left=(.width-.ball16.width)/2
.ball17.width=.ball17.width+arVector[17,2]
.ball17.left=(.width-.ball17.width)/2
.ball18.width=.ball18.width+arVector[18,2]
.ball18.left=(.width-.ball18.width)/2
*** Loop flickers a lot
*!*	FOR C = 1 TO 6
*!*	oBall=EVALUATE([.ball]+TRANSFORM(C))
*!*	oBall.height=200*ABS(SIN(DTOR(arVector[C,1])))
*!*	oBall.top=((.top-oBall.height)/2)-31
*!*	arVector[C,2]=IIF(arVector[C,1]>179,-1,;
                 *IIF(arVector[C,1]<1,1,arVector[C,2]))
*!*	arVector[C+6,1]=arVector[C+6,1]+arVector[C+6,2]
*!*	oBall=EVALUATE([.ball]+TRANSFORM(C+6))
*!*	oBall.width=200*ABS(COS(DTOR(arVector[C+6,1])))
*!*	oBall.left=(.width-oBall.width)/2
*!*	arVector[C+6,2]=IIF(arVector[C+6,1]>179,-1,;
                   *IIF(arVector[C+6,1]<1,1,arVector[C+6,2]))
*!*	ENDFOR 
ENDWITH 
ENDPROC 

PROCEDURE getvector(nPtr)
RETURN IIF(arVector[nPtr,1]>179,-1,;
       IIF(arVector[nPtr,1]<1,1,arVector[nPtr,2]))
PROCEDURE getoscilate(oBall,nPtr)
RETURN IIF(oBall.width>199,-1,IIF(oBall.width<1,1,arVector[nPtr,2]))

DEFINE CLASS theButton as CommandButton 
visible=.t.
top=0
left=0
height=20
width=60
fontsize=8
PROCEDURE click
IF this.Caption=[Back]
   thisform.backcolor=GETCOLOR(thisform.backcolor)
ELSE
IF this.Caption=[Split]
   this.Caption=[Join]
   thisform.ball19.visible=.f.
   thisform.ball20.visible=.f.   
   nTopOff=278
ELSE
IF this.Caption=[Join]
   this.Caption=[Split]
   thisform.ball19.visible=.t.
   thisform.ball20.visible=.t.   
   nTopOff=74
ENDIF
ENDIF
ENDIF 
ENDPROC
ENDDEFINE 

DEFINE CLASS theSpinner as Spinner
visible=.t.
width=40
height=20
fontsize=8
left=0
top=0
spinnerlowvalue=0
spinnerhighvalue=99
value=11
PROCEDURE interactivechange
IF this.Name=[RATE]
    thisform.t1.interval=this.Value
ELSE 
    setcurve(thisform,this.value)
ENDIF 
ENDPROC
ENDDEFINE 

PROCEDURE setcurve(oform,nCurve)
FOR c=1 TO 20
cSet=[oform.ball]+TRANSFORM(C)+[.curvature]
&cSet=nCurve
ENDFOR 
ENDPROC 
*END Mantra.PRG
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform