Page 1 of 2

Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 4:28 am
by idle
AvgSceneGraph

Create Animated Vector graphic Scenes
It's not tied to any gadget so it can be technically used for any vector surface

you can have multiple scenes on a surface, like tab pages or views
zoom and pan a scene (right click move mouse and wheel)
pick and move objects (left down move mouse)
pick and scale object (not shown)
set objects visible / not visible (not shown)

Modify, Add or remove elements from objects dynamically at runtime via callbacks
objects are a runtime display lists of drawing instructions so all the parameters are modifiable at runtime

Assign animations on events (not shown)

You will be able to use it to design elements of a UI and edit it live

Things to come
parametric primitives so they can be shape morphed like circle to star, circle to heart

Save and restore to json and export the code and maybe if I get tricky export as binary to a data section and execute it from memory.

I'm still working out the structure and event propagation which isn't sorted yet so this is very much a WIP

https://atomicwebserver.com/AVGSceneGraph.pbi


Image

https://atomicwebserver.com/avgscenegraph.mp4

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 12:17 pm
by minimy
Hey idle, you have good coffe too! :lol:
As allways an amazing code.
Tested in PB6.3b3 and work perfect.
Thank you very much idle for share this great addition.

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 6:40 pm
by idle
minimy wrote: Thu Oct 16, 2025 12:17 pm Hey idle, you have good coffe too! :lol:
As allways an amazing code.
Tested in PB6.3b3 and work perfect.
Thank you very much idle for share this great addition.
Thanks but there are still bugs the outline square with red circle doesn't move together properly. I think I know how to fix it.

Edit:Edit Almost Fixed :evil:

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 9:15 pm
by mk-soft
Not run :(
---------------------------
PureBasic
---------------------------
Line 862: Structure not found: Displaylist.
---------------------------
OK
---------------------------

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 9:16 pm
by mk-soft
Ok,

need PB v6.30

or change line 862 to run on v6.21

Code: Select all

;Prototype pDiplayListgCB(*avg.Displaylist,mousex.d,mousey.d) 
Prototype pDiplayListgCB(*avg,mousex.d,mousey.d) 

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 9:22 pm
by idle
mk-soft wrote: Thu Oct 16, 2025 9:16 pm Ok,

need PB v6.30
Thanks for info fixed Prototype pDiplayListgCB(*avg,mousex.d,mousey.d)
and it will work with 6.03+

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 9:29 pm
by idle
idle wrote: Thu Oct 16, 2025 9:22 pm
mk-soft wrote: Thu Oct 16, 2025 9:16 pm Ok,

need PB v6.30
Thanks for info fixed Prototype pDiplayListgCB(*avg,mousex.d,mousey.d)
and it will work with 6.03+
I still got to fix the move position for moving child objects.
Edit: Think its done now!

another bug is that it draws an object at the wrong position on reverse animation. you can see it flash for one frame.

Re: Animated Vector Graphics Scene Graph

Posted: Thu Oct 16, 2025 10:09 pm
by idle
Fixed the flash on reverse animation.

Added button using paths, linear gradients, border, with swap gradient color and border color on hover and scales on click

*note the animation updates are still being worked on but this gives you an idea of where it's going.

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 6:54 am
by idle
added a switch button
still need to work on the child offsets it makes it a bit tricky to position with -offsets.

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 11:00 am
by Mesa
For information, i tested it on pb6.03 x86 and everything works except, it crashes when the mouse cursor hover the orange box with this message error: line 2464: array index out of limit.

Code: Select all

If *scene\mouseButton  And *obj\params[index]\isHovered 
M.

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 11:18 am
by Mesa
If i replace line 994: 'params.AVGObjectParams[10] ;temporary fix' by 'params.AVGObjectParams[100] ;temporary fix'
The error is replaced by an ima line 2459 'If (*obj\events\onMouseMove And isSelected = *obj\id)'

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 11:28 am
by idle
Thanks I will look at in morning, its probably not unsurprising that it crashed, I'm only testing it with 6.30 and x64. The parameters index is currently static 10 items per object. When you add a path to an object it increments the index so if that exceeds 10 it will crash. Im also short cutting the dereference which might be a problem 6.03 x86v. It will be changed to a dynamic array and structure will be adapted to a union to reduce size and rhen you will also have a set of scene parameters, object param to override and item param to override so it behaves like CSS.

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 12:42 pm
by acreis
Beautifulllll

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 5:20 pm
by mk-soft
macOS:

No circles are displayed in macOS !?

Re: Animated Vector Graphics Scene Graph

Posted: Fri Oct 17, 2025 9:26 pm
by idle
Mesa wrote: Fri Oct 17, 2025 11:18 am If i replace line 994: 'params.AVGObjectParams[10] ;temporary fix' by 'params.AVGObjectParams[100] ;temporary fix'
The error is replaced by an ima line 2459 'If (*obj\events\onMouseMove And isSelected = *obj\id)'
fixed: was the function definition missing the button parameter from the prototype