├── .gitignore ├── Exo-Regular.ttf ├── LICENSE ├── Label.tscn ├── Legend.gd ├── Legend.tscn ├── Line2D.gd ├── README.md ├── TweenLine2D.tscn ├── default_env.tres ├── godot_tween_cheatsheet_v4.png ├── godot_tween_cheatsheet_v4.png.import ├── icon.png ├── icon.png.import ├── main.tscn ├── project.godot ├── tween_visualize.gd └── tween_visualize.tscn /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Godot-specific ignores 3 | .import/ 4 | export.cfg 5 | export_presets.cfg 6 | 7 | # Mono-specific ignores 8 | .mono/ 9 | data_*/ 10 | -------------------------------------------------------------------------------- /Exo-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wandomPewlin/godotTweeningCheatSheet/db37a5a85ce3813d9ab2f41cc931afdfe4980bc1/Exo-Regular.ttf -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 wandomPewlin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Label.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://Exo-Regular.ttf" type="DynamicFontData" id=1] 4 | 5 | [sub_resource type="DynamicFont" id=1] 6 | size = 48 7 | font_data = ExtResource( 1 ) 8 | 9 | [node name="Label" type="Label"] 10 | self_modulate = Color( 1, 1, 1, 0.286275 ) 11 | margin_right = 40.0 12 | margin_bottom = 14.0 13 | custom_fonts/font = SubResource( 1 ) 14 | text = "TRANS_ELASTIC" 15 | __meta__ = { 16 | "_edit_use_anchors_": false 17 | } 18 | -------------------------------------------------------------------------------- /Legend.gd: -------------------------------------------------------------------------------- 1 | extends Control 2 | 3 | 4 | func _ready(): 5 | pass # Replace with function body. 6 | 7 | func set_color(col): 8 | $Label2.self_modulate = col 9 | $ColorRect.color = col 10 | func set_text(txt): 11 | $Label2.text = txt 12 | -------------------------------------------------------------------------------- /Legend.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=5 format=2] 2 | 3 | [ext_resource path="res://Exo-Regular.ttf" type="DynamicFontData" id=1] 4 | [ext_resource path="res://Label.tscn" type="PackedScene" id=2] 5 | [ext_resource path="res://Legend.gd" type="Script" id=3] 6 | 7 | [sub_resource type="DynamicFont" id=1] 8 | resource_local_to_scene = true 9 | size = 18 10 | font_data = ExtResource( 1 ) 11 | 12 | [node name="Legend" type="Control"] 13 | margin_left = 323.0 14 | margin_top = 213.0 15 | margin_right = 513.0 16 | margin_bottom = 258.0 17 | script = ExtResource( 3 ) 18 | __meta__ = { 19 | "_edit_use_anchors_": false 20 | } 21 | 22 | [node name="Label2" type="Label" parent="." instance=ExtResource( 2 )] 23 | self_modulate = Color( 0.72549, 0, 2.57255, 0.8 ) 24 | anchor_left = 0.5 25 | anchor_top = 0.5 26 | anchor_right = 0.5 27 | anchor_bottom = 0.5 28 | margin_left = -56.6778 29 | margin_top = -30.0 30 | margin_right = 115.322 31 | margin_bottom = 30.0 32 | custom_fonts/font = SubResource( 1 ) 33 | text = "TRANS_ELASTIC" 34 | valign = 1 35 | __meta__ = { 36 | "_edit_use_anchors_": false 37 | } 38 | 39 | [node name="ColorRect" type="ColorRect" parent="."] 40 | anchor_top = 0.5 41 | anchor_bottom = 0.5 42 | margin_top = -15.5 43 | margin_right = 31.0 44 | margin_bottom = 15.5 45 | -------------------------------------------------------------------------------- /Line2D.gd: -------------------------------------------------------------------------------- 1 | extends Line2D 2 | 3 | var vals = [] 4 | 5 | 6 | func add_val(v): 7 | vals.append(v) 8 | 9 | func show_line(interval = 8.0): 10 | var x = 0.0 11 | for v in vals: 12 | add_point(Vector2(x,v)) 13 | x += interval 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Godot Tweening Cheat Sheet 2 | 3 | ![Godot Tweening Cheat Sheet](godot_tween_cheatsheet_v4.png) 4 | 5 | Modified and improved Godot project to render the above image. Modifications were made so that people can format the charts at run-time to see the result in realtime (the logic is currently implemented with brute-force approach. It would be awesome if you could make a pull request if you have better or more elegant way of doing this). The title and attribution watermark are not included in this version. The repo is under MIT license, in my "not a lawyer" understanding, that means you can do whatever you want with this. It would be nice if you can attribute the work to `Wandom Pewlin` or link to this repo somehow. 6 | -------------------------------------------------------------------------------- /TweenLine2D.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=3 format=2] 2 | 3 | [ext_resource path="res://Line2D.gd" type="Script" id=1] 4 | 5 | [sub_resource type="Curve" id=1] 6 | resource_local_to_scene = true 7 | max_value = 2.0 8 | _data = [ Vector2( 0, 0.618182 ), 0.0, 11.3206, 0, 0, Vector2( 0.131868, 1.49091 ), 0.22562, 0.22562, 0, 0, Vector2( 0.873626, 1.49091 ), 0.0, 0.0, 0, 0, Vector2( 1, 0.6 ), -10.7545, 0.0, 0, 0 ] 9 | 10 | [node name="Line2D" type="Line2D"] 11 | width = 2.0 12 | width_curve = SubResource( 1 ) 13 | default_color = Color( 0.4, 0.501961, 1, 1 ) 14 | joint_mode = 2 15 | begin_cap_mode = 2 16 | end_cap_mode = 2 17 | antialiased = true 18 | script = ExtResource( 1 ) 19 | -------------------------------------------------------------------------------- /default_env.tres: -------------------------------------------------------------------------------- 1 | [gd_resource type="Environment" load_steps=2 format=2] 2 | 3 | [sub_resource type="ProceduralSky" id=1] 4 | 5 | [resource] 6 | background_mode = 2 7 | background_sky = SubResource( 1 ) 8 | -------------------------------------------------------------------------------- /godot_tween_cheatsheet_v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wandomPewlin/godotTweeningCheatSheet/db37a5a85ce3813d9ab2f41cc931afdfe4980bc1/godot_tween_cheatsheet_v4.png -------------------------------------------------------------------------------- /godot_tween_cheatsheet_v4.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/godot_tween_cheatsheet_v4.png-d7afe5d9bd85e342c6f5e8a847eb0e59.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://godot_tween_cheatsheet_v4.png" 13 | dest_files=[ "res://.import/godot_tween_cheatsheet_v4.png-d7afe5d9bd85e342c6f5e8a847eb0e59.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wandomPewlin/godotTweeningCheatSheet/db37a5a85ce3813d9ab2f41cc931afdfe4980bc1/icon.png -------------------------------------------------------------------------------- /icon.png.import: -------------------------------------------------------------------------------- 1 | [remap] 2 | 3 | importer="texture" 4 | type="StreamTexture" 5 | path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" 6 | metadata={ 7 | "vram_texture": false 8 | } 9 | 10 | [deps] 11 | 12 | source_file="res://icon.png" 13 | dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] 14 | 15 | [params] 16 | 17 | compress/mode=0 18 | compress/lossy_quality=0.7 19 | compress/hdr_mode=0 20 | compress/bptc_ldr=0 21 | compress/normal_map=0 22 | flags/repeat=0 23 | flags/filter=true 24 | flags/mipmaps=false 25 | flags/anisotropic=false 26 | flags/srgb=2 27 | process/fix_alpha_border=true 28 | process/premult_alpha=false 29 | process/HDR_as_SRGB=false 30 | process/invert_color=false 31 | stream=false 32 | size_limit=0 33 | detect_3d=true 34 | svg/scale=1.0 35 | -------------------------------------------------------------------------------- /main.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=4 format=2] 2 | 3 | [ext_resource path="res://icon.png" type="Texture" id=1] 4 | [ext_resource path="res://shaders/base_canvas.shader" type="Shader" id=2] 5 | 6 | [sub_resource type="ShaderMaterial" id=1] 7 | shader = ExtResource( 2 ) 8 | 9 | [node name="Node2D" type="Node2D"] 10 | 11 | [node name="Sprite" type="Sprite" parent="."] 12 | material = SubResource( 1 ) 13 | position = Vector2( 512.5, 302.5 ) 14 | scale = Vector2( 16.1406, 9.54688 ) 15 | texture = ExtResource( 1 ) 16 | -------------------------------------------------------------------------------- /project.godot: -------------------------------------------------------------------------------- 1 | ; Engine configuration file. 2 | ; It's best edited using the editor UI and not directly, 3 | ; since the parameters that go here are not all obvious. 4 | ; 5 | ; Format: 6 | ; [section] ; section goes between [] 7 | ; param=value ; assign values to parameters 8 | 9 | config_version=4 10 | 11 | _global_script_classes=[ ] 12 | _global_script_class_icons={ 13 | 14 | } 15 | 16 | [application] 17 | 18 | config/name="tween_visualizer" 19 | run/main_scene="res://tween_visualize.tscn" 20 | boot_splash/bg_color=Color( 0.262745, 0.403922, 0.643137, 1 ) 21 | config/icon="res://icon.png" 22 | 23 | [display] 24 | 25 | window/size/width=1600 26 | window/size/height=900 27 | 28 | [editor_plugins] 29 | 30 | enabled=PoolStringArray( ) 31 | 32 | [rendering] 33 | 34 | environment/default_clear_color=Color( 0.109804, 0.109804, 0.109804, 1 ) 35 | environment/default_environment="res://default_env.tres" 36 | -------------------------------------------------------------------------------- /tween_visualize.gd: -------------------------------------------------------------------------------- 1 | extends Node2D 2 | 3 | onready var tween = $Tween 4 | var easing_pairs = [ 5 | [Tween.EASE_IN,"EASE_IN"], 6 | [Tween.EASE_OUT,"EASE_OUT"], 7 | [Tween.EASE_IN_OUT,"EASE_IN_OUT"], 8 | [Tween.EASE_OUT_IN,"EASE_OUT_IN"], 9 | ] 10 | var transition_pairs = [ 11 | [Tween.TRANS_SINE,"SINE"], 12 | [Tween.TRANS_QUINT,"QUINT"], 13 | [Tween.TRANS_QUART,"QUART"], 14 | [Tween.TRANS_QUAD,"QUAD"], 15 | [Tween.TRANS_EXPO,"EXPO"], 16 | [Tween.TRANS_ELASTIC,"ELASTIC"], 17 | [Tween.TRANS_CUBIC,"CUBIC"], 18 | [Tween.TRANS_CIRC,"CIRC"], 19 | [Tween.TRANS_BOUNCE,"BOUNCE"], 20 | [Tween.TRANS_BACK,"BACK"], 21 | [Tween.TRANS_LINEAR,"LINEAR"], 22 | ] 23 | const lScn = preload("res://TweenLine2D.tscn") 24 | const labelScn = preload("res://Label.tscn") 25 | const legendScn = preload("res://Legend.tscn") 26 | 27 | 28 | export var color_ease_in = Color(0.35,0.85,0.55,0.85) setget set_color_ease_in 29 | export var color_ease_out = Color(0.85,0.45,0.35,0.85) setget set_color_ease_out 30 | export var color_ease_inout = Color(0.35,0.25,0.95,0.85) setget set_color_ease_inout 31 | export var color_ease_outin = Color(0.95,0.45,0.85,0.85) setget set_color_ease_outin 32 | 33 | export var row0_y = 100 setget set_row0_y 34 | export var row1_y = 410 setget set_row1_y 35 | export var row2_y = 670 setget set_row2_y 36 | export var charts_offset_x = 30 setget set_charts_offset_x 37 | export var legend_interval_y = 40 setget set_legend_interval_y 38 | export var chart_label_offset = Vector2(-10,0) setget set_chart_label_offset 39 | export var column_spacing = 280 setget set_column_spacing 40 | 41 | # Following params will not take effect until you press the "Draw" button again 42 | # This controls the resolution of the curve, higher resolution curves take longer to draw 43 | export var tween_duration = 2.0 44 | export var x_step_curve = 1.8 45 | export var chart_height = 200 46 | 47 | func _on_Button_pressed(): 48 | draw_lines() 49 | 50 | func draw_lines(): 51 | render_curves() 52 | format_charts() 53 | 54 | var charts = [] 55 | func render_curves(): 56 | for chart in charts: 57 | chart.queue_free() 58 | charts = [] 59 | for transition_pair in transition_pairs: 60 | var chart = [] 61 | for easing_pair in easing_pairs: 62 | var l = lScn.instance() as Line2D 63 | if l: 64 | add_child(l) 65 | tween.interpolate_method(l,"add_val",chart_height,0,tween_duration,transition_pair[0],easing_pair[0]) 66 | tween.interpolate_callback(l,tween_duration,"show_line",x_step_curve) 67 | chart.append(l) 68 | charts.append(chart) 69 | tween.start() 70 | 71 | var chart_elements = [] 72 | func format_charts(): 73 | for chart_element in chart_elements: 74 | chart_element.queue_free() 75 | chart_elements = [] 76 | var count = 1 77 | var ofs = Vector2(charts_offset_x,row0_y) 78 | var ofs_step = Vector2(column_spacing,0.0) 79 | for chart in charts: 80 | if count % 3 == 2: 81 | ofs = Vector2(ofs.x,row2_y) 82 | elif count % 3 == 1: 83 | ofs = Vector2(ofs.x,row1_y) 84 | else: 85 | ofs = Vector2(ofs.x,row0_y) 86 | for i in chart.size(): 87 | var curve = chart[i] 88 | curve.position = ofs 89 | curve.default_color = index_to_color(i) 90 | var chart_label = labelScn.instance() as Label 91 | if chart_label: 92 | add_child(chart_label) 93 | chart_elements.append(chart_label) 94 | chart_label.text = transition_pairs[count - 1][1] 95 | chart_label.rect_position = ofs + chart_label_offset 96 | if count % 3 == 2: 97 | ofs += ofs_step 98 | count += 1 99 | ofs = Vector2(charts_offset_x,row0_y) 100 | for i in easing_pairs.size(): 101 | var legend = legendScn.instance() as Control 102 | if legend: 103 | add_child(legend) 104 | chart_elements.append(legend) 105 | legend.rect_position = ofs 106 | ofs.y += legend_interval_y 107 | legend.set_color(index_to_color(i)) 108 | legend.set_text(easing_pairs[i][1]) 109 | 110 | func index_to_color(i): 111 | match i: 112 | 0: 113 | return color_ease_in 114 | 1: 115 | return color_ease_out 116 | 2: 117 | return color_ease_inout 118 | 3: 119 | return color_ease_outin 120 | func set_color_ease_in(val): 121 | color_ease_in = val 122 | format_charts() 123 | func set_color_ease_out(val): 124 | color_ease_out = val 125 | format_charts() 126 | func set_color_ease_inout(val): 127 | color_ease_inout = val 128 | format_charts() 129 | func set_color_ease_outin(val): 130 | color_ease_outin = val 131 | format_charts() 132 | 133 | func set_row0_y(val): 134 | row0_y = val 135 | format_charts() 136 | func set_row1_y(val): 137 | row1_y = val 138 | format_charts() 139 | func set_row2_y(val): 140 | row2_y = val 141 | format_charts() 142 | func set_charts_offset_x(val): 143 | charts_offset_x = val 144 | format_charts() 145 | func set_legend_interval_y(val): 146 | legend_interval_y = val 147 | format_charts() 148 | func set_chart_label_offset(val): 149 | chart_label_offset = val 150 | format_charts() 151 | func set_column_spacing(val): 152 | column_spacing = val 153 | format_charts() 154 | -------------------------------------------------------------------------------- /tween_visualize.tscn: -------------------------------------------------------------------------------- 1 | [gd_scene load_steps=2 format=2] 2 | 3 | [ext_resource path="res://tween_visualize.gd" type="Script" id=1] 4 | 5 | [node name="Node2D" type="Node2D"] 6 | script = ExtResource( 1 ) 7 | 8 | [node name="Tween" type="Tween" parent="."] 9 | 10 | [node name="Button" type="Button" parent="."] 11 | margin_left = 1379.02 12 | margin_top = 680.527 13 | margin_right = 1462.02 14 | margin_bottom = 736.527 15 | text = "Draw" 16 | __meta__ = { 17 | "_edit_use_anchors_": false 18 | } 19 | [connection signal="pressed" from="Button" to="." method="_on_Button_pressed"] 20 | --------------------------------------------------------------------------------