└── addons └── radial_progress ├── RadialProgress.gd.uid ├── radial_progress.gd.uid ├── version.py ├── icon.png ├── plugin.cfg ├── radial_progress.gd ├── icon.png.import ├── LICENSE └── RadialProgress.gd /addons/radial_progress/RadialProgress.gd.uid: -------------------------------------------------------------------------------- 1 | uid://cbc6r3x84ejtj 2 | -------------------------------------------------------------------------------- /addons/radial_progress/radial_progress.gd.uid: -------------------------------------------------------------------------------- 1 | uid://c044gp6y6yk0s 2 | -------------------------------------------------------------------------------- /addons/radial_progress/version.py: -------------------------------------------------------------------------------- 1 | major = 2 2 | minor = 1 3 | patch = 3 4 | status = "dev" 5 | -------------------------------------------------------------------------------- /addons/radial_progress/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daveTheOldCoder/godot-radial-progress-indicator/HEAD/addons/radial_progress/icon.png -------------------------------------------------------------------------------- /addons/radial_progress/plugin.cfg: -------------------------------------------------------------------------------- 1 | [plugin] 2 | 3 | name="Radial Progress" 4 | description="A radial progress indicator with custom options." 5 | author="Kamel Mohammad, DaveTheCoder" 6 | version="2.1.3-dev" 7 | script="radial_progress.gd" 8 | -------------------------------------------------------------------------------- /addons/radial_progress/radial_progress.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends EditorPlugin 3 | 4 | func _enter_tree() -> void: 5 | add_custom_type("RadialProgress", "Control", preload("RadialProgress.gd"),\ 6 | preload("icon.png")); 7 | 8 | func _exit_tree() -> void: 9 | remove_custom_type("RadialProgress"); 10 | -------------------------------------------------------------------------------- /addons/radial_progress/icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="CompressedTexture2D" 5 | uid="uid://cojmeyox20kw0" 6 | path="res://.godot/imported/icon.png-adf6f5c4053260b4ba2c68f666f66cdd.ctex" 7 | metadata={ 8 | "vram_texture": false 9 | } 10 | 11 | [deps] 12 | 13 | source_file="res://addons/radial_progress/icon.png" 14 | dest_files=["res://.godot/imported/icon.png-adf6f5c4053260b4ba2c68f666f66cdd.ctex"] 15 | 16 | [params] 17 | 18 | compress/mode=0 19 | compress/high_quality=false 20 | compress/lossy_quality=0.7 21 | compress/hdr_compression=1 22 | compress/normal_map=0 23 | compress/channel_pack=0 24 | mipmaps/generate=false 25 | mipmaps/limit=-1 26 | roughness/mode=0 27 | roughness/src_normal="" 28 | process/fix_alpha_border=true 29 | process/premult_alpha=false 30 | process/normal_map_invert_y=false 31 | process/hdr_as_srgb=false 32 | process/hdr_clamp_exposure=false 33 | process/size_limit=0 34 | detect_3d/compress_to=1 35 | -------------------------------------------------------------------------------- /addons/radial_progress/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-present Kamel Mohammad (Original author) 4 | Copyright (c) 2023-present DaveTheCoder (Revisor) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /addons/radial_progress/RadialProgress.gd: -------------------------------------------------------------------------------- 1 | @tool 2 | extends Control 3 | class_name RadialProgress 4 | 5 | @export var max_value: float = 100.0 6 | @export var radius: float = 120.0 7 | @export var progress: float = 0.0 8 | @export var thickness: float = 20.0 9 | @export var bg_color := Color(0.5, 0.5, 0.5, 1.0) 10 | @export var bar_color := Color(0.2, 0.9, 0.2, 1.0) 11 | @export var ring: bool = false 12 | @export var nb_points: int = 32 13 | 14 | func _draw() -> void: 15 | var angle: float = (progress / max_value) * TAU 16 | if ring: 17 | draw_ring_arc(Vector2.ZERO, radius, radius-thickness, 0.0, TAU, bg_color) 18 | draw_ring_arc(Vector2.ZERO, radius, radius-thickness, 0.0, angle, bar_color) 19 | else: 20 | draw_circle_arc(Vector2.ZERO, radius, 0.0, TAU, bg_color) 21 | draw_circle_arc(Vector2.ZERO, radius, 0.0, angle, bar_color) 22 | draw_circle_arc(Vector2.ZERO, radius - thickness, 0.0, TAU, bg_color) 23 | 24 | 25 | func _process(_delta: float) -> void: 26 | queue_redraw() 27 | 28 | 29 | func animate(duration: float, clockwise: bool = true, initial_value: float = 0.0)\ 30 | -> void: 31 | var from: float = initial_value if clockwise else max_value 32 | var to: float = max_value if clockwise else initial_value 33 | var tween: Tween = create_tween() 34 | tween.tween_property(self, "progress", to, duration).from(from)\ 35 | .set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_IN) 36 | await tween.finished 37 | 38 | 39 | func draw_circle_arc(center: Vector2, radius: float, angle_from: float,\ 40 | angle_to: float, color: Color) -> void: 41 | var points_arc := PackedVector2Array() 42 | points_arc.push_back(center) 43 | var colors := PackedColorArray([color]) 44 | var a: float = angle_from - (PI / 2.0) 45 | var b: float = (angle_to - angle_from) / float(nb_points) 46 | for i in range(nb_points + 1): 47 | var angle_point: float = a + float(i) * b 48 | points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius) 49 | draw_polygon(points_arc, colors) 50 | 51 | 52 | func draw_ring_arc(center: Vector2, radius1: float, radius2: float,\ 53 | angle_from: float, angle_to: float, color: Color) -> void: 54 | var points_arc := PackedVector2Array() 55 | var colors := PackedColorArray([color]) 56 | var a: float = angle_from - (PI / 2.0) 57 | var b: float = (angle_to - angle_from) / float(nb_points) 58 | for i in range(nb_points + 1): 59 | var angle_point: float = a + float(i) * b 60 | points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius1) 61 | for i in range(nb_points, -1, -1): 62 | var angle_point: float = a + float(i) * b 63 | points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius2) 64 | draw_polygon(points_arc, colors) 65 | --------------------------------------------------------------------------------