44
55https://github.com/mrtnRitter/DearPyGui_Animate
66
7- v0.1
7+ v0.11
88----------------------------------------------
99"""
1010
11+
1112#-----------------------------------------------------------------------------
1213# Imports
1314#-----------------------------------------------------------------------------
1920
2021
2122#-----------------------------------------------------------------------------
22- # Global Registers
23+ # Global Registers
2324#-----------------------------------------------------------------------------
2425
2526animations = []
3031
3132
3233#-----------------------------------------------------------------------------
33- # Main Functions
34+ # Main Functions
3435#-----------------------------------------------------------------------------
3536
3637def add (type , object , startval , endval , ease , duration , ** kwargs ):
@@ -146,7 +147,7 @@ def run():
146147 animation [16 ] = True
147148 frame = animation [8 ] / animation [6 ]
148149 ease = BezierTransistion (frame , animation [5 ])
149-
150+
150151 if animation [1 ] == "position" :
151152 add_delta_positions (animation , ease )
152153
@@ -459,11 +460,11 @@ def add_delta_opacities(animation, ease):
459460 """
460461
461462 global delta_opacities
462-
463+
463464 for item in delta_opacities :
464465 if animation [2 ] == item [0 ]:
465466 o_step = animation [4 ] * (ease - animation [9 ])
466-
467+
467468 item [1 ] += o_step
468469
469470 if animation [8 ] < animation [6 ] or animation [10 ]:
@@ -474,7 +475,7 @@ def add_delta_opacities(animation, ease):
474475
475476 if animation [8 ] == animation [6 ] and not item [2 ]:
476477 item [2 ] = False
477-
478+
478479 break
479480 else :
480481 delta_opacities .append ([animation [2 ], animation [3 ], True ])
@@ -550,7 +551,7 @@ def set_opacity():
550551 """
551552
552553 global delta_opacities
553-
554+
554555 items_updated = []
555556
556557 for item in delta_opacities :
@@ -561,19 +562,21 @@ def set_opacity():
561562 elif item [2 ]:
562563 item [2 ] = None
563564 items_updated .append (item )
564-
565- if get_item_type (item [0 ]) == "mvAppItemType::Text" :
566- new_color = get_item_configuration (item [0 ])["color" ]
565+
566+ if get_item_type (item [0 ]) == "mvAppItemType::Text" :
567+ new_color = get_item_configuration (item [0 ])["color" ]
568+
569+ # react to a bug in DearPyGui style system - review this when 0.7 is out
570+ if new_color [0 ] > 255 :
571+ new_color = [255 ,255 ,255 ,255 ]
567572
568- # react to a bug in DearPyGui style system - review this when 0.7 is out
569- if new_color [0 ] > 255 :
570- new_color = [255 ,255 ,255 ,255 ]
573+ new_color [3 ] = item [1 ]* 255
574+ configure_item (item [0 ], color = new_color )
571575
572- new_color [3 ] = item [1 ]* 255
573- configure_item (item [0 ], color = new_color )
574-
575- else :
576- set_item_style_var (item [0 ], mvGuiStyleVar_Alpha , [item [1 ]])
576+ else :
577+ set_item_style_var (item [0 ], mvGuiStyleVar_Alpha , [item [1 ]])
578+
579+
577580
578581
579582 delta_opacities = items_updated
0 commit comments