forked from ceceppa/anima
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reference.json
7392 lines (6691 loc) · 179 KB
/
reference.json
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"name": "Anima",
"description": "",
"version": null,
"classes": [
{
"name": "",
"path": "res://addons/anima/core/old_anima.gd",
"extends_class": [
],
"extends_file": "",
"icon": "",
"signature": "class old_anima.gd",
"description": "extends Node\n\nconst BASE_PATH := 'res://addons/anima/animations/'\nconst DEFAULT_DURATION := 0.7\n\n\nenum Visibility {\n\tIGNORE,\n\tHIDDEN_ONLY,\n\tTRANSPARENT_ONLY,\n\tHIDDEN_AND_TRANSPARENT\n}\n\nvar _animations_list := []\n\nfunc get_available_animations() -> Array:\n\tif _animations_list.size() == 0 or true:\n\t\t_animations_list = _get_animations_list()\n\n\treturn _animations_list\n\n#\n# Animates a single node\n#\n# @param array sequence_data array of animation data:\n#\t\t{\n#\t\t\tnode = the node to animate\n#\t\t\tanimation = the animation to play\n#\t\t\tduration = duration in seconds\n#\t\t\tdelay = delay in seconds,\n#\t\t\tloop = loop animation?\n#\t\t\thide = tells if the node needs to be hidden before the animation starts (Default false)\n#\t\t\tcompleted = callback\n#\t\t}\nfunc create_animation(animation_name: String, data: Dictionary) -> AnimationPlayer:\n\tvar duration: float = _get_value(data, 'duration', DEFAULT_DURATION)\n\tvar delay: float = _get_value(data, 'delay', 0.0)\n\tvar animation_player := _get_anima_animation_player(data.node)\n\n\tif animation_player.has_animation(animation_name):\n\t\tvar existing_animation := animation_player.get_animation(animation_name)\n\n\t\tif existing_animation.length == data.duration:\n\t\t\treturn animation_player\n\n\tvar animation = Animation.new()\n\n\tanimation_player.remove_animation(animation_name)\n\tanimation_player.stop()\n\n\tanimation.set_length(data.duration + delay)\n\tanimation_player.add_animation(animation_name, animation)\n\n\t_add_animation_to_animation_resource(\n\t\tanimation,\n\t\t{\n\t\t\tanimation = data.animation,\n\t\t\tnode = data.node,\n\t\t\tduration = data.duration,\n\t\t\tdelay = delay,\n\t\t\tloop = _get_value(data, 'loop', false),\n\t\t\tloop_delay = _get_value(data, 'loop_delay', 0.0),\n\t\t\thide_strategy = _get_value(data, 'hide_strategy', Visibility.IGNORE),\n\t\t\tcallback = _get_value(data, 'callback', null)\n\t\t}\n\t)\n\n\treturn animation_player\n\nfunc create(data: Dictionary) -> AnimaTweens:\n\tvar animation := AnimaTweens.new()\n\n\tadd_child(animation)\n\n\tanimation.set_data(data)\n\n\treturn animation\n\nfunc animate(data: Dictionary) -> AnimaTweens:\n\tvar animation := create(data)\n\n\tanimation.play()\n\n\treturn animation\n\n#\tvar animation_name = data.node.name + \".\" + data.animation\n#\n#\tvar animation_player := create_animation(animation_name, data)\n#\n#\tanimation_player.play(animation_name)\n#\n#\treturn animation_player\n\n#\n# Allows to specify the animations to be played in sequence.\n#\n# @param array sequence_data array of animation data:\n#\t\t{\n#\t\t\tnode = the node to animate\n#\t\t\tanimation = the animation to play\n#\t\t\tduration = duration in seconds\n#\t\t\tdelay = delay in seconds,\n#\t\t\tloop = loop animation?\n#\t\t\tcompleted = callback\n#\t\t}\n# @param hide_nodes_strategy set if the nodes needs to be hidden, make transparent or leave as they are\n#\nfunc create_sequence_animation(sequence_name: String, sequence_data: Array, hide_nodes_strategy: int = Visibility.IGNORE) -> AnimationPlayer:\n\tvar animation_player := _add_multiple_animations(sequence_name, sequence_data, hide_nodes_strategy, 1)\n\n\tanimation_player.connect(\"animation_started\", self, '_on_animation_started', [ sequence_data ])\n\n\treturn animation_player\n\nfunc sequence(sequence_data: Array, hide_nodes_strategy: int = Visibility.IGNORE) -> AnimationPlayer:\n\tif sequence_data.size() == 0:\n\t\tprinterr(\"no sequence animation defined\")\n\n\t\treturn null\n\n\tvar first_sequance = sequence_data[0]\n\tvar sequence_name = first_sequance.node.name + first_sequance.animation + '.sequence'\n\tvar animation_player := create_sequence_animation(sequence_name, sequence_data, hide_nodes_strategy)\n\n\tanimation_player.play(sequence_name)\n\n\treturn animation_player\n\n#\n# Allows to specify the animations to be played in parallel.\n#\n# @param array sequence_data array of animation data:\n#\t\t{\n#\t\t\tnode = the node to animate\n#\t\t\tanimation = the animation to play\n#\t\t\tduration = duration in seconds\n#\t\t\tdelay = delay in seconds,\n#\t\t\tloop = loop animation?\n#\t\t\tcompleted = callback\n#\t\t}\n# @param hide_nodes if true the node is automatically when its animation is not \"playing\"\n#\nfunc create_parallel_animation(sequence_name: String, sequence_data: Array, hide_nodes_strategy: int = Visibility.IGNORE) -> AnimationPlayer:\n\treturn _add_multiple_animations(sequence_name, sequence_data, hide_nodes_strategy, 0)\n\nfunc parallel(sequence_data: Array, hide_nodes_strategy: int = Visibility.IGNORE) -> AnimationPlayer:\n\tif sequence_data.size() == 0:\n\t\tprinterr(\"no sequence animation defined\")\n\n\t\treturn null\n\n\tvar first_sequance = sequence_data[0]\n\tvar sequence_name = first_sequance.node.name + first_sequance.animation + '.sequence'\n\tvar animation_player := create_parallel_animation(sequence_name, sequence_data, hide_nodes_strategy)\n\n\tanimation_player.play(sequence_name)\n\n\treturn animation_player\n\n#\n# Allows to easily animate a specific attribute\n#\n# @param data = {\n#\tnode = node to animate\n# attribute = attribute to animate, i.g.: modulate, offset,\n#\tfrom = initial value,\n#\tto = final value,\n#\teasing = not used yet,\n#\tduration = animation duration,\n#\tdelay = animation delay,\n#\tpivot = the node pivot,\n#\treset: bool = reset initial position\n# }\nfunc create_attribute_animation(animation_name: String, data: Dictionary) -> AnimationPlayer:\n\tvar animation_player := _get_anima_animation_player(data.node)\n\tvar animation := generate_attribute_animation(animation_name, data)\n\n\tanimation_player.add_animation(animation_name, animation)\n\tanimation_player.set_assigned_animation(animation_name)\n\n\treturn animation_player\n\nfunc generate_attribute_animation(animation_name: String, data: Dictionary) -> Animation:\n\tvar animation := Animation.new()\n\tvar track_index = animation.add_track(Animation.TYPE_VALUE)\n\n\tvar node: CanvasItem = data.node\n\tvar node_path := str(node.get_path())\n\tvar duration: float = _get_value(data, 'duration', DEFAULT_DURATION)\n\tvar delay: float = _get_value(data, 'delay', 0.0)\n\tvar hide_strategy: int = _get_value(data, 'hide_strategy', Visibility.IGNORE)\n\tvar reset_original_value: bool = _get_value(data, 'reset', false)\n\tvar track_path: String = node_path + \":\" + data.attribute\n\n\tanimation.track_set_path(track_index, track_path)\n\n\tif data.has('pivot'):\n\t\tAnimaNodesProperties.set_pivot(node, data.pivot)\n\n\tanimation.track_insert_key(track_index, delay + 0.0, data.from)\n\n\tif reset_original_value:\n\t\tanimation.track_insert_key(track_index, (delay + duration) * 0.5, data.to)\n\t\tanimation.track_insert_key(track_index, delay + duration, data.from)\n\telse:\n\t\tanimation.track_insert_key(track_index, delay + duration, data.to)\n\n\t_set_hide_strategy(node, animation, delay, hide_strategy)\n\t_setup_animation_params(animation, track_index, duration + delay, data)\n\tanimation.set_meta('_anima_animation_name', animation_name)\n\n\treturn animation\n\nfunc animate_attribute(data: Dictionary) -> AnimationPlayer:\n\tvar animation_name = data.node.name + \".\" + data.attribute\n\tvar animation_player := create_attribute_animation(animation_name, data)\n\n\tanimation_player.play(animation_name)\n\n\treturn animation_player\n\n#\n# Animate the Control/Sprite position\n#\n# @param data = {\n#\tnode = node to animate\n#\tfrom: Vector2 = (optional) the starting position. If not set the current position will be used\n#\tto: Vector2 = final position. If relative is set to true, this will indicates the difference in px from the current position\n#\trelative: bool = true means that the \"to\" param indicates the difference in px from the current position. Default false\n#\treset_position: bool = if true will also animate the position back to the original one. Default false\n#\thide_strategy: Visibility = the hide strategy to use. Default Visibility.IGNORE,\n#\tloop: bool = should the animation be looped\n#\tease: Easing = the easing to apply\n# }\n#\n#\nfunc create_position_animation(animation_name, data: Dictionary) -> AnimationPlayer:\n\treturn create_attribute_animation(animation_name, data)\n\nfunc generate_position_animation(animation_name: String, data: Dictionary) -> Animation:\n\tvar node = data.node\n\tif not data.has('from'):\n\t\tdata.from = AnimaNodesProperties.get_position(node)\n\n\tif data.has('relative') and data.relative:\n\t\tdata.to = data.from + data.to\n\n\tdata.attribute = AnimaNodesProperties.get_offset_property(node)\n\tdata.reset = _get_value(data, 'reset_position', false)\n\n\treturn generate_attribute_animation(animation_name, data)\n\nfunc _get_value(data: Dictionary, key: String, default):\n\treturn data[key] if data.has(key) else default\n\nfunc _get_anima_animation_player(node: CanvasItem) -> AnimationPlayer:\n\tfor child in node.get_children():\n\t\tif child is AnimationPlayer and child.name.find(\"Anima\") >= 0:\n\t\t\treturn child\n\n\tvar animation_player: AnimationPlayer = AnimationPlayer.new()\n\tanimation_player.name = \"AnimaTweenPlayer\"\n\n\tnode.add_child(animation_player)\n\n\treturn animation_player\n\nfunc _setup_animation_params(animation: Animation, track_id: int, length: float, data: Dictionary) -> void:\n\tvar loop: bool = _get_value(data, 'loop', false)\n\tvar loop_delay: float = _get_value(data, 'loop', 0.0)\n\tvar clamp_animation: bool = _get_value(data, '_clamp_animation', false)\n\n\tanimation.set_loop(loop)\n\n\tif loop and loop_delay > 0 or clamp_animation:\n\t\tanimation.track_set_interpolation_loop_wrap(track_id, false)\n\t\tlength += loop_delay\n\telse:\n\t\tanimation.track_set_interpolation_loop_wrap(track_id, true)\n\n\tanimation.length = length\n\n#\n# Creates/Update Animation\n#\n# @param animation_data = {\n#\tgroup = the animation group name.\n#\tnode = the node to animate\n#\tanimation = the Anima animation to use\n#\tduration = the duration in seconds (default = 0.7s)\n#\tdelay = the animation delay (default = 0.s)\n# }\n#\n# animation_name: String, node: CanvasItem, animation: String, duration_in_seconds: float = 0.7, delay_in_seconds: float = 0, loop: bool = false\n# \nfunc _add_animation_to_animation_resource(animation_resource: Animation, animation_data: Dictionary) -> void:\n\tvar node_path = animation_data.node.get_path()\n\n\tvar script_file = _get_full_script_path(animation_data.animation)\n\n\tif script_file == '':\n\t\tprinterr('No animation found with name %s' % [animation_data.animation])\n\n\t\treturn\n\n\tvar hide_strategy: int = _get_value(animation_data, 'hide_strategy', Visibility.IGNORE)\n\n\t_generate_animation({\n\t\tanimation_resource = animation_resource,\n\t\tscript = script_file, \n\t\tnode = animation_data.node,\n\t\tduration = animation_data.duration,\n\t\tdelay = animation_data.delay,\n\t\thide_strategy = hide_strategy,\n\t\tcompleted = _get_value(animation_data, 'completed', null)\n\t})\n\n#\n# Invoke the script tha generates the animation and return the Animation node\n#\n# @param data {\n# \tscript = the full script path to load\n#\tnode = the node to animate\n#\tduration = duration in seconds\n#\tdelay = delay in seconds\n#\thide = should the element be hidden before starting the animation? Default is true if delay time is bigger than 0\n#\nfunc _generate_animation(data: Dictionary) -> Animation:\n\tvar animation_script = load(data.script).new()\n\tvar animation: Animation = data.animation_resource\n\tvar node: CanvasItem = data.node\n\tvar duration: float = data.duration\n\tvar delay: float = _get_value(data, 'delay', 0.0)\n\tvar hide_strategy: int = _get_value(data, 'hide_strategy', Visibility.IGNORE)\n\n\tvar real_duration = animation_script.generate_animation(animation, data.node, duration, delay)\n\tvar node_path = str(node.get_path())\n\n\t_set_hide_strategy(node, animation, delay, hide_strategy)\n\n\tif real_duration is float and real_duration > 0:\n\t\tduration = real_duration\n\n\tif data.has('completed') and data.completed != null:\n\t\tvar timer := _get_anima_timer(node)\n\t\ttimer.one_shot = true\n\t\ttimer.wait_time = delay + duration\n\n\t\tvar is_already_connected := timer.is_connected(\"timeout\", self, '_on_timer_timeout')\n\t\tif is_already_connected:\n\t\t\ttimer.disconnect(\"timeout\", self, '_on_timer_timeout')\n\n\t\ttimer.connect(\"timeout\", self, '_on_timer_timeout', data.completed)\n\n\tanimation.set_length(duration + delay)\n\n\treturn animation\n\nfunc _set_hide_strategy(node: CanvasItem, animation: Animation, delay: float, hide_strategy: int) -> void:\n\tvar node_path = str(node.get_path())\n\n\t# Animating the \"visible\" property causes a glitch, were you can see, for a fraction,\n\t# the node to be rendered in is original state before carrying on with the animation.\n\t# To avoid this we hide it makeing it transparent\n\tif hide_strategy == Visibility.TRANSPARENT_ONLY or hide_strategy == Visibility.HIDDEN_AND_TRANSPARENT:\n\t\tvar can_set_modulate = not _is_node_animation_opacity(node, animation)\n\n\t\tvar modulate = node.modulate\n\t\tvar transparent = modulate\n\t\ttransparent.a = 0\n\n\t\tvar modulate_track_index = animation.add_track(Animation.TYPE_VALUE)\n\n\t\tanimation.track_set_path(modulate_track_index, node_path + \":modulate\")\n\t\tif can_set_modulate:\n\t\t\tanimation.track_insert_key(modulate_track_index, 0, transparent)\n\t\t\tanimation.track_insert_key(modulate_track_index, delay, transparent)\n\t\t\tanimation.track_insert_key(modulate_track_index, delay + 0.01, modulate)\n\n\t\t_make_node_transparent(node)\n\n\tif hide_strategy == Visibility.HIDDEN_ONLY or hide_strategy == Visibility.HIDDEN_AND_TRANSPARENT:\n\t\tvar visibility_track_index = animation.add_track(Animation.TYPE_VALUE)\n\n\t\tanimation.track_set_path(visibility_track_index, node_path + \":visible\")\n\t\tanimation.track_insert_key(visibility_track_index, 0, false)\n\t\tanimation.track_insert_key(visibility_track_index, delay - 0.01, true)\n\n\t\tnode.hide()\n\n#\n# If any of the animation is changing the :modulate property\n# we don't have to make the component visibile inside the modulate_track_index\nfunc _is_node_animation_opacity(node: CanvasItem, animation: Animation) -> bool:\n\tvar track_count = animation.get_track_count()\n\tvar path = str(node.get_path())\n\n\tfor track_index in track_count:\n\t\tvar track_path: String = str(animation.track_get_path(track_index))\n\n\t\tif track_path.begins_with(path) and track_path.ends_with(':modulate'):\n\t\t\treturn true\n\n\treturn false\n\nfunc _make_node_transparent(node) -> void:\n\tvar modulate = node.modulate\n\tvar transparent = modulate\n\n\ttransparent.a = 0\n\n\tnode.modulate = transparent\n\nfunc _get_anima_timer(node: CanvasItem) -> Timer:\n\tvar children = node.get_children()\n\n\tfor child in children:\n\t\tif child is Timer and child.name.begins_with('AnimaTimer'):\n\t\t\treturn child\n\n\tvar timer = Timer.new()\n\ttimer.name = 'AnimaTimer'\n\n\tnode.add_child(timer)\n\n\treturn timer\n\nfunc _add_multiple_animations(sequence_name: String, animations: Array, hide_nodes_strategy: int, delay_multiplier: int = 1) -> AnimationPlayer:\n\tvar next_delay := 0.0\n\tvar total_duration := 0.0\n\tvar first_node: CanvasItem\n\tvar first_player: AnimationPlayer\n\tvar should_copy_animation := false\n\n\tvar animation = Animation.new()\n\tvar index := 0\n\tfor data in animations:\n\t\tif data is Animation:\n\t\t\tvar node_path = str(data.track_get_path(0)).split(':')[0]\n\t\t\tvar node = get_node(node_path)\n\n\t\t\tif not first_player:\n\t\t\t\tfirst_player = _get_anima_animation_player(node)\n\n\t\t\t_copy_and_transpose_animation_track(data, animation, total_duration * delay_multiplier)\n\t\telse:\n\t\t\tif not first_player:\n\t\t\t\tfirst_node = animations[0].node\n\t\t\t\tfirst_player = _get_anima_animation_player(first_node)\n\n\t\t\t\tif first_player.has_animation(sequence_name):\n\t\t\t\t\tfirst_player.remove_animation(sequence_name)\n\n\t\t\tvar duration = _get_value(data, 'duration', DEFAULT_DURATION)\n\t\t\tvar delay = _get_value(data, 'delay', 0.0)\n\t\t\tvar hide_strategy = _get_value(data, 'hide_strategy', Visibility.IGNORE)\n\t\t\tvar completed = _get_value(data, 'completed', null)\n\n\t\t\t_add_animation_to_animation_resource(\n\t\t\t\tanimation,\n\t\t\t\t{\n\t\t\t\t\tnode = data.node,\n\t\t\t\t\tanimation = data.animation,\n\t\t\t\t\tduration = duration,\n\t\t\t\t\tdelay = delay + next_delay,\n\t\t\t\t\thide_strategy = hide_nodes_strategy,\n\t\t\t\t\tcompleted = completed\n\t\t\t\t}\n\t\t\t)\n\n\t\tnext_delay = animation.length * delay_multiplier\n\t\ttotal_duration += animation.length\n\t\tindex += 1\n\n\tanimation.length = total_duration\n\n\tif first_player:\n\t\tfirst_player.add_animation(sequence_name, animation)\n\t\tfirst_player.set_assigned_animation(sequence_name)\n\n\t\treturn first_player\n\n\tprinterr('The animations data contains no node!')\n\n\treturn AnimationPlayer.new()\n\nfunc _get_animations_list() -> Array:\n\tvar files = _get_scripts_in_dir(BASE_PATH)\n\n\tfiles.sort()\n\treturn files\n\nfunc _copy_and_transpose_animation_track(source: Animation, dest: Animation, offset: float) -> void:\n\tvar animation_name: String = source.get_meta('_anima_animation_name')\n\n\tfor track_index in range(0, source.get_track_count()):\n\t\tsource.copy_track(track_index, dest)\n\n\t\tvar new_track_index = dest.get_track_count() - 1\n\t\tvar track_type := source.track_get_type(new_track_index)\n\n\t\tfor key_index in range(0, dest.track_get_key_count(new_track_index)):\n\t\t\tvar original_key_time := dest.track_get_key_time(track_index, key_index)\n\t\t\tvar new_key_time := original_key_time + offset\n\n\t\t\tif original_key_time != new_key_time:\n\t\t\t\tdest.track_set_key_time(track_index, key_index, new_key_time)\n\nfunc _get_scripts_in_dir(path: String, files: Array = []) -> Array:\n\tvar dir = Directory.new()\n\tif dir.open(path) != OK:\n\t\treturn files\n\n\tdir.list_dir_begin()\n\tvar file_name = dir.get_next()\n\n\twhile file_name != \"\":\n\t\tif file_name != \".\" and file_name != \"..\":\n\t\t\tif dir.current_is_dir():\n\t\t\t\t_get_scripts_in_dir(path + file_name + '/', files)\n\t\t\telse:\n\t\t\t\tfiles.push_back(path + file_name)\n\n\t\tfile_name = dir.get_next()\n\n\treturn files\n\nfunc _get_full_script_path(animation_name: String) -> String:\n\tif not animation_name.ends_with('.gd'):\n\t\tanimation_name += '.gd'\n\n\tanimation_name = AnimaStrings.from_camel_to_snack_case(animation_name)\n\n\tfor file_name in get_available_animations():\n\t\tif file_name.ends_with(animation_name):\n\t\t\treturn file_name\n\n\treturn ''\n\nfunc _on_animation_started(name: String, data) -> void:\n\tfor item in data:\n\t\tif item is Dictionary and item.has('completed') and item.completed:\n\t\t\tvar timer := _get_anima_timer(item.node)\n\n\t\t\ttimer.stop()\n\t\t\ttimer.start()\n\nfunc _on_timer_timeout(func_ref: FuncRef, parameter) -> void:\n\tfunc_ref.call_funcv(parameter)\n",
"sub_classes": [
],
"constants": [
],
"members": [
],
"signals": [
],
"methods": [
],
"static_functions": [
]
},
{
"name": "",
"path": "res://addons/anima/core/anima.gd",
"extends_class": [
"Node"
],
"extends_file": "",
"icon": "",
"signature": "class anima.gd",
"description": "",
"sub_classes": [
],
"constants": [
{
"name": "Grid",
"value": {
"SEQUENCE_TOP_LEFT": 0
},
"data_type": "Dictionary",
"signature": "const Grid: Dictionary = {\"SEQUENCE_TOP_LEFT\":0}",
"description": ""
},
{
"name": "EASING",
"value": {
"LINEAR": 0,
"EASE": 1,
"EASE_IN_OUT": 2,
"EASE_IN": 3,
"EASE_OUT": 4,
"EASE_IN_SINE": 5,
"EASE_OUT_SINE": 6,
"EASE_IN_OUT_SINE": 7,
"EASE_IN_QUAD": 8,
"EASE_OUT_QUAD": 9,
"EASE_IN_OUT_QUAD": 10,
"EASE_IN_CUBIC": 11,
"EASE_OUT_CUBIC": 12,
"EASE_IN_OUT_CUBIC": 13,
"EASE_IN_QUART": 14,
"EASE_OUT_QUART": 15,
"EASE_IN_OUT_QUART": 16,
"EASE_IN_QUINT": 17,
"EASE_OUT_QUINT": 18,
"EASE_IN_OUT_QUINT": 19,
"EASE_IN_EXPO": 20,
"EASE_OUT_EXPO": 21,
"EASE_IN_OUT_EXPO": 22,
"EASE_IN_CIRC": 23,
"EASE_OUT_CIRC": 24,
"EASE_IN_OUT_CIRC": 25,
"EASE_IN_BACK": 26,
"EASE_OUT_BACK": 27,
"EASE_IN_OUT_BACK": 28,
"EASE_IN_ELASTIC": 29,
"EASE_OUT_ELASTIC": 30,
"EASE_IN_OUT_ELASTIC": 31,
"EASE_IN_BOUNCE": 32,
"EASE_OUT_BOUNCE": 33,
"EASE_IN_OUT_BOUNCE": 34
},
"data_type": "Dictionary",
"signature": "const EASING: Dictionary = {\"EASE\":1,\"EASE_IN\":3,\"EASE_IN_BACK\":26,\"EASE_IN_BOUNCE\":32,\"EASE_IN_CIRC\":23,\"EASE_IN_CUBIC\":11,\"EASE_IN_ELASTIC\":29,\"EASE_IN_EXPO\":20,\"EASE_IN_OUT\":2,\"EASE_IN_OUT_BACK\":28,\"EASE_IN_OUT_BOUNCE\":34,\"EASE_IN_OUT_CIRC\":25,\"EASE_IN_OUT_CUBIC\":13,\"EASE_IN_OUT_ELASTIC\":31,\"EASE_IN_OUT_EXPO\":22,\"EASE_IN_OUT_QUAD\":10,\"EASE_IN_OUT_QUART\":16,\"EASE_IN_OUT_QUINT\":19,\"EASE_IN_OUT_SINE\":7,\"EASE_IN_QUAD\":8,\"EASE_IN_QUART\":14,\"EASE_IN_QUINT\":17,\"EASE_IN_SINE\":5,\"EASE_OUT\":4,\"EASE_OUT_BACK\":27,\"EASE_OUT_BOUNCE\":33,\"EASE_OUT_CIRC\":24,\"EASE_OUT_CUBIC\":12,\"EASE_OUT_ELASTIC\":30,\"EASE_OUT_EXPO\":21,\"EASE_OUT_QUAD\":9,\"EASE_OUT_QUART\":15,\"EASE_OUT_QUINT\":18,\"EASE_OUT_SINE\":6,\"LINEAR\":0}",
"description": ""
},
{
"name": "Visibility",
"value": {
"IGNORE": 0,
"HIDDEN_ONLY": 1,
"TRANSPARENT_ONLY": 2,
"HIDDEN_AND_TRANSPARENT": 3
},
"data_type": "Dictionary",
"signature": "const Visibility: Dictionary = {\"HIDDEN_AND_TRANSPARENT\":3,\"HIDDEN_ONLY\":1,\"IGNORE\":0,\"TRANSPARENT_ONLY\":2}",
"description": ""
},
{
"name": "PIVOT",
"value": {
"CENTER": 0,
"CENTER_BOTTOM": 1,
"TOP_CENTER": 2,
"TOP_LEFT": 3,
"LEFT_BOTTOM": 4,
"RIGHT_BOTTOM": 5
},
"data_type": "Dictionary",
"signature": "const PIVOT: Dictionary = {\"CENTER\":0,\"CENTER_BOTTOM\":1,\"LEFT_BOTTOM\":4,\"RIGHT_BOTTOM\":5,\"TOP_CENTER\":2,\"TOP_LEFT\":3}",
"description": ""
},
{
"name": "BASE_PATH",
"value": "res://addons/anima/animations/",
"data_type": "String",
"signature": "const BASE_PATH: String = \"res://addons/anima/animations/\"",
"description": ""
}
],
"members": [
{
"name": "_animations_list",
"data_type": "Array",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _animations_list: Array",
"description": ""
},
{
"name": "_custom_animations",
"data_type": "Array",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _custom_animations: Array",
"description": ""
}
],
"signals": [
],
"methods": [
{
"name": "begin",
"return_type": "AnimaNode",
"rpc_mode": 0,
"signature": "func begin(node, name: String = \"anima\") -> AnimaNode",
"description": "",
"arguments": [
{
"name": "node",
"type": "var"
},
{
"name": "name",
"type": "String",
"default_value": "anima"
}
]
},
{
"name": "group",
"return_type": "AnimaGrid",
"rpc_mode": 0,
"signature": "func group(group_node: Node) -> AnimaGrid",
"description": "",
"arguments": [
{
"name": "group_node",
"type": "Node"
}
]
},
{
"name": "register_animation",
"return_type": "null",
"rpc_mode": 0,
"signature": "func register_animation(script, animation_name: String) -> null",
"description": "",
"arguments": [
{
"name": "script",
"type": "var"
},
{
"name": "animation_name",
"type": "String"
}
]
},
{
"name": "_deregiter_animation",
"return_type": "null",
"rpc_mode": 0,
"signature": "func _deregiter_animation(animation_name: String) -> null",
"description": "",
"arguments": [
{
"name": "animation_name",
"type": "String"
}
]
},
{
"name": "get_available_animations",
"return_type": "Array",
"rpc_mode": 0,
"signature": "func get_available_animations() -> Array",
"description": "",
"arguments": [
]
},
{
"name": "get_animation_script",
"return_type": "var",
"rpc_mode": 0,
"signature": "func get_animation_script(animation_name: String)",
"description": "",
"arguments": [
{
"name": "animation_name",
"type": "String"
}
]
},
{
"name": "is_built_in_animation",
"return_type": "bool",
"rpc_mode": 0,
"signature": "func is_built_in_animation(animation_name: String) -> bool",
"description": "",
"arguments": [
{
"name": "animation_name",
"type": "String"
}
]
},
{
"name": "get_animation_script_with_path",
"return_type": "String",
"rpc_mode": 0,
"signature": "func get_animation_script_with_path(animation_name: String) -> String",
"description": "",
"arguments": [
{
"name": "animation_name",
"type": "String"
}
]
},
{
"name": "_get_animations_list",
"return_type": "Array",
"rpc_mode": 0,
"signature": "func _get_animations_list() -> Array",
"description": "",
"arguments": [
]
},
{
"name": "_get_scripts_in_dir",
"return_type": "Array",
"rpc_mode": 0,
"signature": "func _get_scripts_in_dir(path: String, files: Array) -> Array",
"description": "",
"arguments": [
{
"name": "path",
"type": "String"
},
{
"name": "files",
"type": "Array"
}
]
}
],
"static_functions": [
]
},
{
"name": "AnimaEasing",
"path": "res://addons/anima/core/easings.gd",
"extends_class": [
],
"extends_file": "",
"icon": "",
"signature": "class AnimaEasing",
"description": "\n Easing functions and code has been inspired from:\n https://easings.net/\n\n",
"sub_classes": [
],
"constants": [
{
"name": "EASING",
"value": {
"LINEAR": 0,
"EASE": 1,
"EASE_IN_OUT": 2,
"EASE_IN": 3,
"EASE_OUT": 4,
"EASE_IN_SINE": 5,
"EASE_OUT_SINE": 6,
"EASE_IN_OUT_SINE": 7,
"EASE_IN_QUAD": 8,
"EASE_OUT_QUAD": 9,
"EASE_IN_OUT_QUAD": 10,
"EASE_IN_CUBIC": 11,
"EASE_OUT_CUBIC": 12,
"EASE_IN_OUT_CUBIC": 13,
"EASE_IN_QUART": 14,
"EASE_OUT_QUART": 15,
"EASE_IN_OUT_QUART": 16,
"EASE_IN_QUINT": 17,
"EASE_OUT_QUINT": 18,
"EASE_IN_OUT_QUINT": 19,
"EASE_IN_EXPO": 20,
"EASE_OUT_EXPO": 21,
"EASE_IN_OUT_EXPO": 22,
"EASE_IN_CIRC": 23,
"EASE_OUT_CIRC": 24,
"EASE_IN_OUT_CIRC": 25,
"EASE_IN_BACK": 26,
"EASE_OUT_BACK": 27,
"EASE_IN_OUT_BACK": 28,
"EASE_IN_ELASTIC": 29,
"EASE_OUT_ELASTIC": 30,
"EASE_IN_OUT_ELASTIC": 31,
"EASE_IN_BOUNCE": 32,
"EASE_OUT_BOUNCE": 33,
"EASE_IN_OUT_BOUNCE": 34
},
"data_type": "Dictionary",
"signature": "const EASING: Dictionary = {\"EASE\":1,\"EASE_IN\":3,\"EASE_IN_BACK\":26,\"EASE_IN_BOUNCE\":32,\"EASE_IN_CIRC\":23,\"EASE_IN_CUBIC\":11,\"EASE_IN_ELASTIC\":29,\"EASE_IN_EXPO\":20,\"EASE_IN_OUT\":2,\"EASE_IN_OUT_BACK\":28,\"EASE_IN_OUT_BOUNCE\":34,\"EASE_IN_OUT_CIRC\":25,\"EASE_IN_OUT_CUBIC\":13,\"EASE_IN_OUT_ELASTIC\":31,\"EASE_IN_OUT_EXPO\":22,\"EASE_IN_OUT_QUAD\":10,\"EASE_IN_OUT_QUART\":16,\"EASE_IN_OUT_QUINT\":19,\"EASE_IN_OUT_SINE\":7,\"EASE_IN_QUAD\":8,\"EASE_IN_QUART\":14,\"EASE_IN_QUINT\":17,\"EASE_IN_SINE\":5,\"EASE_OUT\":4,\"EASE_OUT_BACK\":27,\"EASE_OUT_BOUNCE\":33,\"EASE_OUT_CIRC\":24,\"EASE_OUT_CUBIC\":12,\"EASE_OUT_ELASTIC\":30,\"EASE_OUT_EXPO\":21,\"EASE_OUT_QUAD\":9,\"EASE_OUT_QUART\":15,\"EASE_OUT_QUINT\":18,\"EASE_OUT_SINE\":6,\"LINEAR\":0}",
"description": ""
},
{
"name": "_easing_mapping",
"value": {
"0": null,
"1": [
0.25,
0.1,
0.25,
1
],
"2": [
0.42,
0,
0.58,
1
],
"3": [
0.42,
0,
1,
1
],
"4": [
0,
0,
0.58,
1
],
"5": [
0,
0,
1,
0.5
],
"6": [
0.61,
1,
0.88,
1
],
"7": [
0.37,
0,
0.63,
1
],
"8": [
0.11,
0,
0.5,
0
],
"9": [
0.5,
1,
0.89,
1
],
"10": [
0.45,
0,
0.55,
1
],
"11": [
0.32,
0,
0.67,
0
],
"12": [
0.33,
1,
0.68,
1
],
"13": [
0.65,
0,
0.35,
1
],
"14": [
0.5,
0,
0.75,
0
],
"15": [
0.25,
1,
0.5,
1
],
"16": [
0.76,
0,
0.24,
1
],
"17": [
0.64,
0,
0.78,
0
],
"18": [
0.22,
1,
0.36,
1
],
"19": [
0.83,
0,
0.17,
1
],
"20": [
0.7,
0,
0.84,
0
],
"21": [
0.16,
1,
0.3,
1
],
"22": [
0.87,
0,
0.13,
1
],
"23": [
0.55,
0,
0.1,
0.45
],
"24": [
0,
0.55,
0.45,
1
],
"25": [
0.85,
0,
0.15,
1
],
"26": [
0.36,
0,
0.66,
-0.56
],
"27": [
0.36,
1.56,
0.64,
1
],
"28": [
0.68,
-0.6,
0.32,
1.6
],
"29": "ease_in_elastic",
"30": "ease_out_elastic",
"31": "ease_in_out_elastic",
"32": "ease_in_bounce",
"33": "ease_out_bounce",
"34": "ease_in_out_bounce"
},
"data_type": "Dictionary",
"signature": "const _easing_mapping: Dictionary = {\"0\":null,\"1\":[0.25,0.1,0.25,1],\"2\":[0.42,0,0.58,1],\"3\":[0.42,0,1,1],\"4\":[0,0,0.58,1],\"5\":[0,0,1,0.5],\"6\":[0.61,1,0.88,1],\"7\":[0.37,0,0.63,1],\"8\":[0.11,0,0.5,0],\"9\":[0.5,1,0.89,1],\"10\":[0.45,0,0.55,1],\"11\":[0.32,0,0.67,0],\"12\":[0.33,1,0.68,1],\"13\":[0.65,0,0.35,1],\"14\":[0.5,0,0.75,0],\"15\":[0.25,1,0.5,1],\"16\":[0.76,0,0.24,1],\"17\":[0.64,0,0.78,0],\"18\":[0.22,1,0.36,1],\"19\":[0.83,0,0.17,1],\"20\":[0.7,0,0.84,0],\"21\":[0.16,1,0.3,1],\"22\":[0.87,0,0.13,1],\"23\":[0.55,0,0.1,0.45],\"24\":[0,0.55,0.45,1],\"25\":[0.85,0,0.15,1],\"26\":[0.36,0,0.66,-0.56],\"27\":[0.36,1.56,0.64,1],\"28\":[0.68,-0.6,0.32,1.6],\"29\":\"ease_in_elastic\",\"30\":\"ease_out_elastic\",\"31\":\"ease_in_out_elastic\",\"32\":\"ease_in_bounce\",\"33\":\"ease_out_bounce\",\"34\":\"ease_in_out_bounce\"}",
"description": ""
},
{
"name": "_ELASTIC_C4",
"value": 2.094395,
"data_type": "float",
"signature": "const _ELASTIC_C4: float = 2.094395",
"description": ""
},
{
"name": "_ELASTIC_C5",
"value": 1.396263,
"data_type": "float",
"signature": "const _ELASTIC_C5: float = 1.396263",
"description": ""
},
{
"name": "n1",
"value": 7.5625,
"data_type": "float",
"signature": "const n1: float = 7.5625",
"description": ""
},
{
"name": "d1",
"value": 2.75,
"data_type": "float",
"signature": "const d1: float = 2.75",
"description": ""
}
],
"members": [
],
"signals": [
],
"methods": [
],
"static_functions": [
{
"name": "get_easing_points",
"return_type": "var",
"rpc_mode": 0,
"signature": "func get_easing_points(easing_name)",
"description": "",
"arguments": [
{
"name": "easing_name",
"type": "var"
}
]
},
{
"name": "ease_in_elastic",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_in_elastic(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
},
{
"name": "ease_out_elastic",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_out_elastic(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
},
{
"name": "ease_in_out_elastic",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_in_out_elastic(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
},
{
"name": "ease_in_bounce",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_in_bounce(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
},
{
"name": "ease_out_bounce",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_out_bounce(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
},
{
"name": "ease_in_out_bounce",
"return_type": "float",
"rpc_mode": 0,
"signature": "func ease_in_out_bounce(elapsed: float) -> float",
"description": "",
"arguments": [
{
"name": "elapsed",
"type": "float"
}
]
}
]
},
{
"name": "AnimaNode",
"path": "res://addons/anima/core/node.gd",
"extends_class": [
"Node"
],
"extends_file": "",
"icon": "",
"signature": "class AnimaNode",
"description": "",
"sub_classes": [
],
"constants": [
],
"members": [
{
"name": "_anima_tween",
"data_type": "AnimaTween",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _anima_tween: AnimaTween",
"description": ""
},
{
"name": "_total_animation",
"data_type": "float",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _total_animation: float",
"description": ""
},
{
"name": "_last_animation_duration",
"data_type": "float",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _last_animation_duration: float",
"description": ""
},
{
"name": "_timer",
"data_type": "Timer",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _timer: Timer",
"description": ""
},
{
"name": "_loop_times",
"data_type": "int",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _loop_times: int",
"description": ""
},
{
"name": "_tweens_left",
"data_type": "int",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _tweens_left: int",
"description": ""
},
{
"name": "_ignore",
"data_type": "var",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _ignore",
"description": ""
}
],
"signals": [
{
"name": "animation_completed",
"arguments": [
],
"signature": "signal animation_completed()",
"description": ""
}
],
"methods": [
{
"name": "_exit_tree",
"return_type": "var",
"rpc_mode": 0,
"signature": "func _exit_tree()",
"description": "",
"arguments": [
]
},
{
"name": "init",
"return_type": "var",
"rpc_mode": 0,
"signature": "func init(node: Node)",
"description": "",
"arguments": [
{
"name": "node",
"type": "Node"
}
]
},
{
"name": "then",
"return_type": "var",
"rpc_mode": 0,
"signature": "func then(data: Dictionary)",
"description": "",
"arguments": [
{
"name": "data",
"type": "Dictionary"
}
]
},
{
"name": "with",
"return_type": "null",
"rpc_mode": 0,
"signature": "func with(data: Dictionary) -> null",
"description": "",
"arguments": [
{
"name": "data",
"type": "Dictionary"
}
]
},
{
"name": "also",
"return_type": "null",
"rpc_mode": 0,
"signature": "func also(data: Dictionary) -> null",
"description": "",
"arguments": [
{
"name": "data",
"type": "Dictionary"
}
]
},
{
"name": "set_visibility_strategy",
"return_type": "null",
"rpc_mode": 0,
"signature": "func set_visibility_strategy(strategy: int) -> null",
"description": "",
"arguments": [
{
"name": "strategy",
"type": "int"
}
]
},
{
"name": "clear",
"return_type": "null",
"rpc_mode": 0,
"signature": "func clear() -> null",
"description": "",
"arguments": [
]
},
{
"name": "play",
"return_type": "null",
"rpc_mode": 0,
"signature": "func play() -> null",
"description": "",
"arguments": [
]
},
{
"name": "stop",
"return_type": "null",
"rpc_mode": 0,
"signature": "func stop() -> null",
"description": "",
"arguments": [
]
},
{
"name": "play_with_delay",
"return_type": "null",
"rpc_mode": 0,
"signature": "func play_with_delay(delay: float) -> null",
"description": "",
"arguments": [
{
"name": "delay",
"type": "float"
}
]
},
{
"name": "get_length",
"return_type": "float",
"rpc_mode": 0,
"signature": "func get_length() -> float",
"description": "",
"arguments": [
]
},
{
"name": "_do_play",
"return_type": "null",
"rpc_mode": 0,
"signature": "func _do_play() -> null",
"description": "",
"arguments": [
]
},
{
"name": "_setup_animation",
"return_type": "float",
"rpc_mode": 0,
"signature": "func _setup_animation(data: Dictionary) -> float",
"description": "",
"arguments": [
{
"name": "data",
"type": "Dictionary"
}
]
},
{
"name": "_on_tween_completed",
"return_type": "null",
"rpc_mode": 0,
"signature": "func _on_tween_completed(_ignore, _ignore2) -> null",
"description": "",
"arguments": [
{
"name": "_ignore",
"type": "var"
},
{
"name": "_ignore2",
"type": "var"
}
]
},
{
"name": "_on_timer_timeout",
"return_type": "null",
"rpc_mode": 0,
"signature": "func _on_timer_timeout() -> null",
"description": "",
"arguments": [
]
},
{
"name": "_on_all_tween_completed",
"return_type": "null",
"rpc_mode": 0,
"signature": "func _on_all_tween_completed() -> null",
"description": "",
"arguments": [
]
}
],
"static_functions": [
]
},
{
"name": "AnimaTween",
"path": "res://addons/anima/core/tween.gd",
"extends_class": [
"Tween"
],
"extends_file": "",
"icon": "",
"signature": "class AnimaTween",
"description": "",
"sub_classes": [
],
"constants": [
],
"members": [
{
"name": "_animation_data",
"data_type": "Array",
"default_value": null,
"setter": "",
"getter": "",
"export": false,
"signature": "var _animation_data: Array",
"description": ""
},
{
"name": "_loops_count",
"data_type": "int",
"default_value": null,
"setter": "",
"getter": "",
"export": false,