Author Topic: LifeTime  (Read 1809 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
LifeTime
« on: June 03, 2013, 07:48:59 AM »
Deleted
« Last Edit: April 25, 2015, 04:25:20 AM by Peter »

JRS

  • Guest
Re: LifeTime
« Reply #1 on: June 03, 2013, 02:51:41 PM »
Attached is Peter's original example done in O2.



X
« Last Edit: June 03, 2013, 04:15:05 PM by JRS »

JRS

  • Guest
Re: LifeTime
« Reply #2 on: June 03, 2013, 05:36:38 PM »
I thought I would expand on Peter's code and see where it would take me. Thanks Peter for this cool demo. The repetition of your code with a twist to compensate for the no line width issue paid off. You should give this a try (SB / O2 / ...) as the patterns it creates are rather random. 



Code: [Select]
' Peter's Lifetime

import japi.bas

declare sub dllsecs alias "dllsecs" lib "DLLC"
' j_setdebug(4)
j_start
win = j_frame("Peter's Lifetime")
can = j_canvas(win, 400, 300)
j_pack(win)
j_show(win)
centerX = fix(j_getwidth(can) / 2)
centerY = fix(j_getheight(can) / 2)
totalLines = 20

REPEAT
j_setnamedcolorbg(can, J_WHITE)
For i = -20 to 20
    offsetX = cos(dllsecs()*i*(0.25 / totalLines))*100    
    offsety = sin(dllsecs()*i*(0.25 / totalLines))*100
    j_setcolor(can,16,128,200)
    j_drawline(can, centerX - offsetX, centerY - offsetY, centerX + offsetX, centerY + offsetY)
    offsetX = cos(dllsecs()*i*(0.50 / totalLines))*100    
    offsety = sin(dllsecs()*i*(0.50 / totalLines))*100
    j_setcolor(can,200,128,16)
    j_drawline(can, centerX - offsetX, centerY - offsetY, centerX + offsetX, centerY + offsetY)
Next
j_sleep(250)
UNTIL 0
j_quit
« Last Edit: June 03, 2013, 07:02:04 PM by JRS »

JRS

  • Guest
Re: LifeTime
« Reply #3 on: June 03, 2013, 09:49:22 PM »
Here is the O2 version of my modification to Peters program. The ZIP contains everything you need to run and compile the example. I was fortunate to be able to get a screen shot that looked like the SB JAPI example.



Code: [Select]
#include "sw.inc"
! timeGetTime  Lib "winmm.dll" () As Long

Window 400,300,1

sys centerX = GetWidth () /2
sys centerY = GetHeight() /2
sys totalLines=20, i, j
single offsetX, offsetY

while Key(27)=0
Cls sw_white
For i= -totalLines to totalLines
    offsetX = cos(timeGetTime()*i*(0.25 / totalLines))*100    
    offsety = sin(timeGetTime()*i*(0.25 / totalLines))*100
    Line centerX-offsetX,centerY-offsetY,centerX+offsetX,centerY+offsetY,1,RGB(16,128,200)
    offsetX = cos(timeGetTime()*i*(0.50 / totalLines))*100    
    offsety = sin(timeGetTime()*i*(0.50 / totalLines))*100
    Line centerX-offsetX,centerY-offsetY,centerX+offsetX,centerY+offsetY,1,RGB(200,128,16)
Next
Sync
SetFps 8
wend
CloseWindow


X