ScreenSaver for fun

Place code snippets and demo code here
Post Reply
RonS
Posts: 261
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 125 times
Been thanked: 65 times

ScreenSaver for fun

Post by RonS »

hi @ALL

inspired by a contribution in another basic forum and with the kind permission of the author, I have created the following 'screensaver' - more for fun and the joy of the beautiful patterns - the clock as a meaningful addition.

code adapted for the annex RDS - 800x 480 - 4,3 inch bright Display
Annex32-S3 CAN DMT LVGL HID OTG 2.00.94 qio opi

Code: [Local Link Removed for Guests]

lvgl.init WHITE, 0x000000 '0x003a57
lvgl.set_theme black, black, 20, 0, 0   
lvgl.load_font "/fonts/clock1.bin",102
lvgl.load_font "/fonts/clock2.bin",103
rem lvgl.remove_flag lvgl.screen, 0x10                ' remove scrollability
lvgl.clean
counter$=""
lb1=LVGL.LABEL " " , 250, 300, 24, 100
  lvgl.set_font lb1, 102
  lvgl.set_pos lb1, 50, 115
  lvgl.set_size lb1, 24, 240
  LVGL.SET_BORDER_WIDTH lb1, 2
  lvgl.set_text_color lb1, 0xFFD700
  lvgl.set_bg_color lb1, 0x000000
  LVGL.SET_BG_OPA lb1, 0 
  '-------------------------------
lb2=LVGL.LABEL " " , 250, 300, 24, 100
  lvgl.set_font lb2, 103
  lvgl.set_pos lb2, 720, 10
  lvgl.set_size lb2, 50, 400
  LVGL.SET_BORDER_COLOR lb2, 0x000000
  LVGL.SET_BORDER_WIDTH lb2, 1
  lvgl.set_text_color lb2, 0xFFD700
  lvgl.set_bg_color lb2, 0x000000
  LVGL.SET_TEXT_ALIGN lb2, 2
  LVGL.SET_BG_OPA lb2, 0   
cntr=0
Do

tft.fill  black

For G=-Rnd()*42 To 1000
tt=rnd()*99:  qq=rnd()*99
uu=rnd()*320: vv=rnd()*240
A=rnd()*3
R=90/(1+rnd()*100)
Q=(1+3)*(0.5+rnd()/2)
aa=1+3*rnd()^2: M=1
If rnd()*9<4 Then Q=R:T=0:qq=0:A=0:M=Pi/3:aa=1
C=(1+3*rnd()^2)*R*R
Color = rnd()*&hFFFFFF
For i=0 To C
  S=-Log(rnd()):  T=i*M
  U=S*R*Sin(T): V=S*Q*Cos(T)
  T=S*A
  X=U*Cos(T)+V*Sin(T)
  Y=V*Cos(T)-U*Sin(T)
  D=(X*X+Y*Y)/(R*R+Q*Q)
  Z=99 * (2.7^-D) + 0.1
  Z=Z*(rnd()-0.5)^3
  y0=Y*Cos(tt)+Z*Sin(tt)
  Z=Z*Cos(tt)-Y*Sin(tt)
  x0=uu+X*Cos(qq)+y0*Sin(qq)
  y0=vv-X*Sin(qq)+y0*Cos(qq)
rem xx0= CONVERT.LIMITS(x0, 0, tft.width)
rem yy0= CONVERT.LIMITS(x0, 0, TFT.HEIGHT)
  tft.Pixel x0*2+50,y0*2+20, color ' faktoren  für  anpassung  an  bildschirmgrösse  engl: faktors   für  adjustment  to  screensize
  cntr=cntr+1
  lvgl.set_text lb1,str$(cntr)
  lvgl.set_text lb2,left$(time$,5)
  lvgl.refresh
Next
Next
tft.save "/sphere.bmp"
Loop
Every loop creates beautiful patterns through random numbers.

Image

PS:Actually, the labels should be translucent. What did I do wrong?

a nice day Ron
You do not have the required permissions to view the files attached to this post.
Last edited by RonS on Fri Jun 27, 2025 5:55 pm, edited 1 time in total.
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
User avatar
Starraker
Posts: 187
Joined: Tue Sep 03, 2024 1:53 am
Location: Canberra Australia
Been thanked: 61 times
Contact:

Re: ScreenSaver for fun

Post by Starraker »

Ron,

Very, very nice and works on a 800 x 480 screen running Annex32-S3 BLE CAN DMT HID OTG 6.00.6 qio opi also the P4 at a higher screen resolution of 1024 x 600 running Annex32-P4 LVGL 6.00.95 qio (in test).

I did not have the two clock fonts but it worked anyway.

Well done,

Paul
Last edited by Starraker on Fri Jun 27, 2025 8:54 pm, edited 1 time in total.
RonS
Posts: 261
Joined: Thu Mar 02, 2023 10:15 pm
Location: germany
Has thanked: 125 times
Been thanked: 65 times

Re: ScreenSaver for fun

Post by RonS »

sry the fonts..
the first is 45 pix and the second 75 pix
You do not have the required permissions to view the files attached to this post.
Modules : 3xESP32-Cam MB (Chip"DM ESP32 S" ),AI-Thinker Audio Kit (ES8388), ESP32 Dev Kit with Display
Post Reply