Skip to content

animation_advanced

Thomas S edited this page Aug 22, 2020 · 2 revisions

Advanced animation
Most uses of animations in uiz will use the uiz_animation_getFunction function, which only supports one formula, and always takes and returns a value from 0 to 1.
Advanced animation can hold more formulas, and can have more steps.
It can be used on any objects(even non-uiz objects) and requires the uiz_animation_init() to be called.
Using these animation scripts generates a few local variables and arrays for the object which you called the function from.

Once you've initialized the animation script, you can create an animation using uiz_animation_create().
Uiz_animation_create(animationtimepoints) takes one argument, the number of "points" the animation should have.
An animation of one point can only has a start and a finish point, while an animation of 100 points, will have 100 places at which you can manipulate it.
You can call the "uiz_animation_create" script as many times as you want and create have as many animations run simultaniousely as you want, just dont call the "uiz_animation_init" script multiple times.

To take a point on the animation timeline and manipulate it you can call "uiz_animation_add(animationid,attime,value,optional curvetype)"
It takes an animationid returnd by "uiz_animation_create" and a an attime value, which is above zero and below (or equal to) the value given to uiz_animation_create().
The value is how "high" the point should be.(Look at the images below for clarification)
"optional curvetype" is an optional value in which you can specify a formula for the graph, which you can find in the "Animations in general" page.

Later, if you have a point, but want to change it, you can do this by using "uiz_animation_setpoint(animationid,attime,value,optional curvetype)".
It takes the same type of arguments as "uiz_animation_add" and changes the value and curvetype of a point at the specified attime.
You cannot change a points attime value after it has been created nor can you delete it.

If you want to change the animations of other objects, you can use the "uiz_animation_applyto(objectid)" function, which requires an object id.
After this has been called al the uiz_animation functions will be executed from the given object.
You won't be able to change or create any animations on your original object which applyto was called from, and so you'll have to use "uiz_animation_applyto(id)" to reset it.

Once you've got all your animations in place, you can use "uiz_animation_get(animationid,attime)", to get your animation at any point in time,
that is bigger (or equal to) 0 and lower (or equal to) the initial "points" value of "uiz_animation_create".


Visual representation of graphs
Example 1:

uiz_animation_init()
anim=uiz_animation_create(100)
uiz_animation_addpoint(anim,33,1,uiz_circular_in)
uiz_animation_addpoint(anim,66,0.5,uiz_wigle)
You can see a few problems with this graph, the first and last path.
By default graphs will start at 0 and stop at 1.
These are straight formulas, and if you don't want this, you'll need to override them as shown in example 2.
uiz_animation_init()
anim=uiz_animation_create(100)
uiz_animation_setfirstpoint(anim,25,uiz_exponential_inout)
uiz_animation_addpoint(anim,33,100,uiz_circular_in)
uiz_animation_addpoint(anim,66,50,uiz_wigle)
uiz_animation_addlastpoint(anim,80)
This graph starts at 24 and ends at 80.

Wiki pages

🏑Home / General
πŸ“ƒTutorials
πŸ‘ͺ Parent
↕️ Positioning
πŸ›  Fixing & Updating
πŸ• Depth
πŸ“ƒ Templates and Examples
πŸŒ† Background
πŸ“‡ Structures
🎈 Objects

obj_uiZ_3waybutton
obj_uiZ_button
obj_uiZ_checkbox
obj_uiZ_clock
obj_uiZ_colorbox
obj_uiZ_cover
obj_uiZ_drawdslist obj_uiZ_dropdown
obj_uiZ_easybutton
obj_uiZ_frame
obj_uiZ_framescrollbar
obj_uiZ_functionbar
obj_uiZ_gradientsquare
obj_uiZ_gradientroundrect
obj_uiZ_gridlist
obj_uiZ_huesquare
obj_uiZ_loadingbar
obj_uiZ_loadingcircle
obj_uiZ_menubutton
obj_uiZ_mousemenu
obj_uiZ_radiobox
obj_uiZ_rotator
obj_uiZ_slider
obj_uiZ_scrollbar
obj_uiZ_slider_2col
obj_uiZ_slickslider
obj_uiZ_slideframe
obj_uiZ_sprbutton
obj_uiZ_spriteanimationbutton
obj_uiZ_spritecounter
obj_uiZ_stringbox
obj_uiZ_sliderstruct
obj_uiZ_surfacecanvas
obj_uiZ_sprite
obj_uiZ_square
obj_uiZ_squarebutton
obj_uiZ_swipicon
obj_uiZ_switch
obj_uiZ_tabslider
obj_uiZ_tabs
obj_uiZ_treelist
obj_uiZ_text
obj_uiZ_text_background
obj_uiZ_textarea
obj_uiZ_valuebox


🎈 Your own objects
🚫 Destroy
🐭 Mouse
πŸ’» Windows (uiz)
🌌 Animations
❓ General
πŸ“’ Numbers
πŸ“’ Strings
✏️ Draw
🚩 Popup
πŸ“‚ Files
πŸ’» Windows (os)
Clone this wiki locally