http://www.tokyoflash.com/fr/watches/ki ... _illusion/

I thought how can I reproduce this effect in PureBasic?
the site can see this image of the watch:

reads 03 51

a moiré effect brings up the time when sufficient fixed image
(disturb your view)
Well, it's the principle of this watch

I made an approximation in which the following code PureBasic :
(a click on the window brings up the time in clear .. as the watch that does the same thing, because it is touch

these images of sprites for code
Block:

block2:

le code :
Code: Select all
UsePNGImageDecoder()
global flag_heure=0,flag_min=0
Enumeration
#window
#block
#block2
#timer
#timer2
EndEnumeration
InitSprite() : InitSprite3D()
Declare WindowCallback(WindowID,message,wParam,lParam)
Declare animation()
if FileSize("illusion.inf")<>-1
openfile(1,"illusion.inf")
global xw=readLong(1)
global yw=readLong(1)
CloseFile(1)
Else
xw=1
yw=1
endif
global taillex=150
global tailley=221
OpenWindow(#window,xw,yw,taillex,tailley,"Illusion",#PB_Window_BorderLess ) ;#PB_Window_SizeGadget
AddWindowTimer(#window,#timer,1000)
AddWindowTimer(#window,#timer2,2000)
OpenWindowedScreen(windowid(#window),1,1,256,440,1,0,0)
SetWindowCallback(@WindowCallback())
;{ ********** dessin du block de base ************
LoadSprite(#block,"E:\Dobro\PureBasic\dobro\Dobro_creation\montre\blockA.png",#PB_Sprite_Texture)
CreateSprite3D(#block,#block)
; lettre
LoadSprite(#block2,"E:\Dobro\PureBasic\dobro\Dobro_creation\montre\blockA2.png",#PB_Sprite_Texture)
CreateSprite3D(#block2,#block2)
;} *********************************************
dim heure(25,18)
dim minut(25,18)
repeat
StartDrawing(ScreenOutput())
if Hour(Date()) <10
DrawText(1,1,"0"+str(Hour(Date())),#green)
else
DrawText(1,1,str(Hour(Date())),#green)
endif
if minute(Date())<10
DrawText(20,1,"0"+str(minute(Date())),#green)
else
DrawText(20,1,str(minute(Date())),#green)
endif
:L=0
for y=0 to 16
for x=1 to 16
heure(x,y)=point(x,y)
minut(x,y)=point(x+20,y)
next x
next y
StopDrawing()
ClearScreen(0)
;{ *********** Affichage ******************* ²
L=0
Start3D()
for y=3 to 16
for x=0 to 16
if heure(x,y)>0
DisplaySprite3D(#block2,(x*16)-32,(y*16)-64)
else
if flag_heure =0
DisplaySprite3D(#block,(x*16)-32,(y*16)-64)
endif
endif
if minut(x,y)>0
DisplaySprite3D(#block2,(x*16)-32,(y*16)+160)
Else
if flag_min=0
DisplaySprite3D(#block,(x*16)-32,(y*16)+160)
endif
endif
next x
next y
Stop3D()
FlipBuffers()
ClearScreen(0)
;} ***************************************²
event= WaitWindowEvent(20)
select event
;case #PB_Event_Timer
case #WM_LBUTTONdown
SendMessage_(WindowID(#Window), #WM_NCLBUTTONDOWN, #HTCAPTION, 0)
flag_min=1
flag_heure=1
openfile(1,"illusion.inf")
WriteLong(1,WindowX(#window))
WriteLong(1,Windowy(#window))
CloseFile(1)
case #WM_RBUTTONdown
event=#PB_Event_CloseWindow
endselect
until event=#PB_Event_CloseWindow
end
;
Procedure WindowCallback(WinID,message,wParam,lParam)
; by Dobro
res=#PB_ProcessPureBasicEvents
Select message
case #WM_LBUTTONUP
;
flag_min=0
flag_heure=0
Case #WM_PAINT
flag_min=0
flag_heure=0
Case #WM_TIMER
if EventTimer() = #timer
flag_min=0
flag_heure=0
animation()
endif
if EventTimer() = #timer2
; rafraichi l'affichage
flag_min=0
flag_heure=0
ResizeWindow(#window,#pb_ignore,#pb_ignore,taillex,tailley)
endif
;EndSelect
EndSelect
ProcedureReturn res ; important , laissez passer les autres evenements !!!
EndProcedure
procedure animation()
static pos_block
static pos_block2
pos_block=pos_block-1
pos_block2=pos_block2+1
if pos_block<0 : pos_block=3:endif
if pos_block2>3
pos_block2=0
RemoveWindowTimer(#Window,#timer)
AddWindowTimer(#window,#timer,random(60000)+10000)
endif
select pos_block
case 0
RotateSprite3D(#block,0,1)
case 1
RotateSprite3D(#block,90,1)
case 2
RotateSprite3D(#block,180,1)
case 3
RotateSprite3D(#block,270,1)
endselect
select pos_block2
case 0
RotateSprite3D(#block2,0,1)
case 1
RotateSprite3D(#block2,90,1)
case 2
RotateSprite3D(#block2,180,1)
case 3
RotateSprite3D(#block2,270,1)
endselect
EndProcedure
;
;
; EPb
rendering has13:02

