-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCubicInterp.tscn
More file actions
85 lines (72 loc) · 1.98 KB
/
CubicInterp.tscn
File metadata and controls
85 lines (72 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
[gd_scene load_steps=2 format=2]
[sub_resource type="GDScript" id=2]
script/source = "extends GraphEdit
func _process(delta):
update()
func _draw():
var a = $A.global_position
var b = $B.global_position
var pre_a= $PreA.global_position
var post_b= $PostB.global_position
var line = []
var times = 100.0
for i in range(times):
var value = i / times
var pos = a.cubic_interpolate(b, pre_a, post_b, value)
line.append(pos)
draw_polyline(line, Color.WHITE, 2, true)
draw_line(a,pre_a,Color.RED,1)
draw_line(b,post_b,Color.GREEN,1)
draw_line(pre_a,post_b,Color.BLUE,1)"
[node name="CubicInterp" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
[node name="GraphicEditor" type="GraphEdit" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
use_snap = false
script = SubResource( 2 )
[node name="A" type="GraphNode" parent="GraphicEditor"]
modulate = Color( 1, 1, 1, 0.501961 )
offset_left = 800.0
offset_top = 450.0
offset_right = 841.0
offset_bottom = 479.0
pivot_offset = Vector2( 20, 14 )
mouse_filter = 1
mouse_default_cursor_shape = 2
title = "A"
offset = Vector2( 800, 450 )
[node name="B" type="GraphNode" parent="GraphicEditor"]
modulate = Color( 1, 1, 1, 0.501961 )
offset_left = 800.0
offset_top = 450.0
offset_right = 841.0
offset_bottom = 479.0
pivot_offset = Vector2( 20, 14 )
mouse_filter = 1
mouse_default_cursor_shape = 2
title = "B"
offset = Vector2( 800, 450 )
[node name="PreA" type="GraphNode" parent="GraphicEditor"]
modulate = Color( 1, 1, 1, 0.501961 )
offset_left = 800.0
offset_top = 450.0
offset_right = 862.0
offset_bottom = 479.0
pivot_offset = Vector2( 31, 14.5 )
mouse_filter = 1
mouse_default_cursor_shape = 2
title = "PreA"
offset = Vector2( 800, 450 )
[node name="PostB" type="GraphNode" parent="GraphicEditor"]
modulate = Color( 1, 1, 1, 0.501961 )
offset_left = 800.0
offset_top = 450.0
offset_right = 869.0
offset_bottom = 479.0
pivot_offset = Vector2( 34.5, 14.5 )
mouse_filter = 1
mouse_default_cursor_shape = 2
title = "PostB"
offset = Vector2( 800, 450 )