Compare commits

...

2 Commits

Author SHA1 Message Date
Rémi Verschelde
5fe6147a34 Add gitignore 2017-07-15 12:34:17 +02:00
Rémi Verschelde
4621cbd2d3 Tween Demo: Fix sprite and color pickers display 2017-07-15 12:33:34 +02:00
6 changed files with 608 additions and 7 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# System/tool-specific ignores
.directory
*~

View File

@@ -1,11 +1,13 @@
[application]
name="Tween Demo"
main_scene="res://main.scn"
main_scene="res://main.tscn"
icon="res://icon.png"
target_fps=60
[display]
height=800
width=1024
stretch_mode="2d"
stretch_aspect="keep_width"

BIN
misc/tween/godot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -25,11 +25,11 @@ func _ready():
var name = modes[index]
get_node("modes/" + name).connect("pressed", self, "on_modes_changed", [name])
get_node("color/color_from").set_color(Color(1, 0, 0, 1))
get_node("color/color_from").connect("color_changed", self, "on_color_changed")
get_node("colors/color_from/picker").set_color(Color(1, 0, 0, 1))
get_node("colors/color_from/picker").connect("color_changed", self, "on_color_changed")
get_node("color/color_to").set_color(Color(0, 1, 1, 1))
get_node("color/color_to").connect("color_changed", self, "on_color_changed")
get_node("colors/color_to/picker").set_color(Color(0, 1, 1, 1))
get_node("colors/color_to/picker").connect("color_changed", self, "on_color_changed")
get_node("trans/linear").set_pressed(true)
get_node("eases/in").set_pressed(true)
@@ -96,8 +96,8 @@ func reset_tween():
tween.interpolate_property(sprite, "transform/pos", Vector2(size.width, size.height), Vector2(0, 0), 2, state.trans, state.eases, 2)
if get_node("modes/color").is_pressed():
tween.interpolate_method(sprite, "set_modulate", get_node("color/color_from").get_color(), get_node("color/color_to").get_color(), 2, state.trans, state.eases)
tween.interpolate_property(sprite, "modulate", get_node("color/color_to").get_color(), get_node("color/color_from").get_color(), 2, state.trans, state.eases, 2)
tween.interpolate_method(sprite, "set_modulate", get_node("colors/color_from/picker").get_color(), get_node("colors/color_to/picker").get_color(), 2, state.trans, state.eases)
tween.interpolate_property(sprite, "modulate", get_node("colors/color_to/picker").get_color(), get_node("colors/color_from/picker").get_color(), 2, state.trans, state.eases, 2)
else:
sprite.set_modulate(Color(1,1,1,1))

Binary file not shown.

591
misc/tween/main.tscn Normal file
View File

@@ -0,0 +1,591 @@
[gd_scene load_steps=3 format=1]
[ext_resource path="res://main.gd" type="Script" id=1]
[ext_resource path="res://godot.png" type="Texture" id=2]
[node name="main" type="Control"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 800.0
margin/bottom = 600.0
script/script = ExtResource( 1 )
__meta__ = {
"__editor_plugin_screen__": "2D"
}
[node name="trans" type="VBoxContainer" parent="."]
editor/display_folded = true
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 56.0
margin/top = 288.0
margin/right = 129.0
margin/bottom = 614.0
alignment = 0
[node name="linear" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 73.0
margin/bottom = 20.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "linear"
flat = false
[node name="sine" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 24.0
margin/right = 73.0
margin/bottom = 44.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "sine"
flat = false
[node name="quint" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 48.0
margin/right = 73.0
margin/bottom = 68.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "quint"
flat = false
[node name="quart" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 72.0
margin/right = 73.0
margin/bottom = 92.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "quart"
flat = false
[node name="quad" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 96.0
margin/right = 73.0
margin/bottom = 116.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "quad"
flat = false
[node name="expo" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 120.0
margin/right = 73.0
margin/bottom = 140.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "expo"
flat = false
[node name="elastic" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 144.0
margin/right = 73.0
margin/bottom = 164.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "elastic"
flat = false
[node name="cubic" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 168.0
margin/right = 73.0
margin/bottom = 188.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "cubic"
flat = false
[node name="circ" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 192.0
margin/right = 73.0
margin/bottom = 212.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "circ"
flat = false
[node name="bounce" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 216.0
margin/right = 73.0
margin/bottom = 236.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "bounce"
flat = false
[node name="back" type="Button" parent="trans"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 240.0
margin/right = 73.0
margin/bottom = 260.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "back"
flat = false
[node name="eases" type="VBoxContainer" parent="."]
editor/display_folded = true
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 152.0
margin/top = 288.0
margin/right = 215.0
margin/bottom = 404.0
alignment = 0
[node name="in" type="Button" parent="eases"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 63.0
margin/bottom = 20.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "in"
flat = false
[node name="out" type="Button" parent="eases"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 24.0
margin/right = 63.0
margin/bottom = 44.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "out"
flat = false
[node name="in_out" type="Button" parent="eases"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 48.0
margin/right = 63.0
margin/bottom = 68.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "in_out"
flat = false
[node name="out_in" type="Button" parent="eases"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 72.0
margin/right = 63.0
margin/bottom = 92.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "out_in"
flat = false
[node name="modes" type="VBoxContainer" parent="."]
editor/display_folded = true
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 240.0
margin/top = 288.0
margin/right = 317.0
margin/bottom = 524.0
alignment = 0
[node name="move" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 77.0
margin/bottom = 20.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "move"
flat = false
[node name="color" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 24.0
margin/right = 77.0
margin/bottom = 44.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "color"
flat = false
[node name="scale" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 48.0
margin/right = 77.0
margin/bottom = 68.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "scale"
flat = false
[node name="rotate" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 72.0
margin/right = 77.0
margin/bottom = 92.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "rotate"
flat = false
[node name="callback" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 96.0
margin/right = 77.0
margin/bottom = 116.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "callback"
flat = false
[node name="follow" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 120.0
margin/right = 77.0
margin/bottom = 140.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "follow"
flat = false
[node name="repeat" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 144.0
margin/right = 77.0
margin/bottom = 164.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "repeat"
flat = false
[node name="pause" type="Button" parent="modes"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 168.0
margin/right = 77.0
margin/bottom = 188.0
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
text = "pause"
flat = false
[node name="colors" type="HBoxContainer" parent="."]
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 384.0
margin/top = 288.0
margin/right = 424.0
margin/bottom = 328.0
custom_constants/separation = 40
alignment = 0
[node name="color_from" type="VBoxContainer" parent="colors"]
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 0.0
margin/right = 288.0
margin/bottom = 459.0
alignment = 0
[node name="label" type="Label" parent="colors/color_from"]
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 0.0
margin/top = 0.0
margin/right = 288.0
margin/bottom = 14.0
text = "Color From:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="picker" type="ColorPicker" parent="colors/color_from"]
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 18.0
margin/right = 288.0
margin/bottom = 459.0
alignment = 0
[node name="color_to" type="VBoxContainer" parent="colors"]
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 328.0
margin/top = 0.0
margin/right = 616.0
margin/bottom = 459.0
alignment = 0
[node name="label" type="Label" parent="colors/color_to"]
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 0.0
margin/top = 0.0
margin/right = 288.0
margin/bottom = 14.0
text = "Color To:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="picker" type="ColorPicker" parent="colors/color_to"]
focus/ignore_mouse = false
focus/stop_mouse = false
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 0.0
margin/top = 18.0
margin/right = 288.0
margin/bottom = 459.0
alignment = 0
[node name="tween" type="Tween" parent="."]
playback/process_mode = 1
playback/active = true
playback/repeat = true
playback/speed = 1.0
[node name="area" type="Panel" parent="tween"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 32.0
margin/top = 32.0
margin/right = 768.0
margin/bottom = 216.0
[node name="label" type="RichTextLabel" parent="tween/area"]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = 176.0
margin/top = 24.0
margin/right = 552.0
margin/bottom = 160.0
bbcode/enabled = false
bbcode/bbcode = ""
visible_characters = -1
percent_visible = 1.0
[node name="sprite" type="Sprite" parent="tween/area"]
texture = ExtResource( 2 )
[node name="follow" type="Sprite" parent="tween/area"]
transform/pos = Vector2( 0, 184 )
texture = ExtResource( 2 )
[node name="follow_2" type="Sprite" parent="tween/area"]
transform/pos = Vector2( 736, 0 )
texture = ExtResource( 2 )
[node name="timeline" type="HSlider" parent="."]
focus/ignore_mouse = false
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 40.0
margin/top = 224.0
margin/right = 760.0
margin/bottom = 240.0
range/min = 0.0
range/max = 100.0
range/step = 1.0
range/page = 0.0
range/value = 1.0
range/exp_edit = false
range/rounded = false
tick_count = 0
ticks_on_borders = false
focus_mode = 2
[connection signal="tween_step" from="tween" to="." method="_on_tween_step"]
[connection signal="value_changed" from="timeline" to="." method="_on_timeline_value_changed"]