Skip to content

Commit

Permalink
Merge pull request #45 from ceceppa/feat/new-documentation
Browse files Browse the repository at this point in the history
Feat/new documentation
  • Loading branch information
ceceppa authored Sep 12, 2024
2 parents d8a7e70 + 757745d commit ec9ddc2
Show file tree
Hide file tree
Showing 743 changed files with 66,518 additions and 33,737 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@ name: "anima doc"
on: push

jobs:
build-docusaurus:
name: Build Docusaurus
build-documentation:
name: Build documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
node-version: 18
cache: yarn
hugo-version: "0.134.0"
- name: Build
run: |
cd docs
yarn install --frozen-lockfile --non-interactive
yarn build
working-directory: ./docs
run: hugo --minify
- name: Checkout Docs repo
uses: actions/checkout@v3
with:
Expand All @@ -35,7 +31,7 @@ jobs:
git config user.email "<senesealessandro@gmail.com>"
rm -rf *
cp -r ../build/* .
cp -r ../public/* .
git add .
git commit -m "Update docs"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ node_modules
docs/*.import
docs/**/.import
.godot/
docs.old
docs/public/
1 change: 0 additions & 1 deletion TestScene/Test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,3 @@ func _on_Button_pressed():
Anima.begin(self).then(
Anima.Node($Button).anima_position_x(half_screen_x, 1).anima_from(-178)
).play_with_delay(1)

12 changes: 7 additions & 5 deletions addons/anima/core/anima_node.gd
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func _exit_tree():
clear()

for child in get_children():
child.free()
child.queue_free()

func _ready():
if not _anima_tween.is_connected("animation_completed",Callable(self,"_on_all_tween_completed")):
Expand Down Expand Up @@ -185,7 +185,7 @@ func _play(mode: int, delay: float = 0.0, speed := 1.0) -> AnimaNode:
_loop_times = 1
_play_mode = mode
_current_play_mode = mode
_play_speed = speed
_play_speed = float(speed)

if _apply_visibility_strategy_on_play and mode == AnimaTween.PLAY_MODE.NORMAL:
set_visibility_strategy(_visibility_strategy)
Expand Down Expand Up @@ -759,13 +759,13 @@ func _maybe_play() -> void:
_loop_times -= 1

if _loop_times > 0 or _should_loop:
if _loop_delay > 0:
if _loop_delay > ANIMA.MINIMUM_DURATION:
_timer.wait_time = _loop_delay
_timer.start()

await _timer.timeout

_do_play()
else:
_do_play()

func _on_all_tween_completed() -> void:
if _loop_times <= 1:
Expand Down Expand Up @@ -793,3 +793,5 @@ func _play_backwards(time: float) -> void:

func debug():
print(get_animation_data())

return self
27 changes: 20 additions & 7 deletions addons/anima/core/declaration/anima_declaration_node.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum PlayAction {
LOOP_TIMES_WITH_DELAY_AND_SPEED
}

func _init(node: Node = null):
func _init(node: Node = null, name = null):
if Engine.is_editor_hint():
_clear_metakeys(node)

Expand All @@ -38,6 +38,7 @@ func _init(node: Node = null):

if node:
_target_data.node = node
_target_data._name = name

func _set_data(data: Dictionary):
for key in data:
Expand All @@ -52,7 +53,8 @@ func _create_declaration_for_animation(data: Dictionary) -> AnimaDeclarationForA
var c:= AnimaDeclarationForAnimation.new(self)

for key in data:
_target_data[key] = data[key]
if not _target_data.has(key):
_target_data[key] = data[key]

return c._init_me(_target_data)

Expand All @@ -63,15 +65,17 @@ func _create_declaration_with_easing(data: Dictionary) -> AnimaDeclarationForPro
data.duration = _target_data.duration

for key in data:
_target_data[key] = data[key]
if not _target_data.has(key):
_target_data[key] = data[key]

return c._init_me(_target_data)

func _create_relative_declaration_with_easing(data: Dictionary) -> AnimaDeclarationForRelativeProperty:
var c:= AnimaDeclarationForRelativeProperty.new(self)

for key in data:
_target_data[key] = data[key]
if not _target_data[key]:
_target_data[key] = data[key]

return c._init_me(_target_data)

Expand Down Expand Up @@ -239,6 +243,12 @@ func clear():
if _anima_node and is_instance_valid(_anima_node):
_anima_node.clear()

var to_ignore = ['node', 'nodes', 'grid', 'group']
for key in _data.keys():
if not to_ignore.has(key):
_data.erase(key)

_target_data = _data
_clear_metakeys(_target_data.node)

return self
Expand Down Expand Up @@ -270,10 +280,13 @@ func _nested_animation(key, new_class, delay):
_target_data[key].delay = delay

var has_duration = _target_data.has("duration")
var duration = _target_data.duration if has_duration else null
var has_easing = _target_data.has("easing")

if has_duration:
_target_data[key].duration = duration
_target_data[key].duration = _target_data.duration

if has_easing:
_target_data[key].easing = _target_data.easing

_target_data = _target_data[key]

Expand Down Expand Up @@ -374,7 +387,7 @@ func play_with_delay(delay: float) -> AnimaNode:
return _do_play(PlayAction.PLAY_WITH_DELAY, delay)

func play_with_speed(speed: float) -> AnimaNode:
return _do_play(PlayAction.PLAY_BACKWARDS_WITH_SPEED, speed)
return _do_play(PlayAction.PLAY_WITH_SPEED, speed)

func play_backwards() -> AnimaNode:
return _do_play(PlayAction.PLAY_BACKWARDS)
Expand Down
13 changes: 11 additions & 2 deletions addons/anima/utils/node_properties.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,20 @@ static func get_rotation(node: Node):

static func set_2D_pivot(node: Node, pivot: int) -> void:
var size: Vector2 = get_size(node)
var meta_key = ANIMA_PIVOT_APPLIED_META

if Engine.is_editor_hint():
meta_key = meta_key + "Editor"

var pivot_size_applied = Vector2.ZERO

if node.has_meta(meta_key):
pivot_size_applied = node.get_meta(meta_key)

if node is Window or node.has_meta(ANIMA_PIVOT_APPLIED_META):
if node is Window or (node.has_meta(meta_key) and size == pivot_size_applied):
return

node.set_meta(ANIMA_PIVOT_APPLIED_META, true)
node.set_meta(meta_key, size)

match pivot:
ANIMA.PIVOT.TOP_CENTER:
Expand Down
2 changes: 1 addition & 1 deletion demos/3d/3DBoxes.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://de2dm72yugi4a"]

[ext_resource type="Script" path="res://demos/3d/3DBoxes.gd" id="1"]
[ext_resource type="ArrayMesh" uid="uid://dsobcrphe0r56" path="res://demos/resources/ring.obj" id="2"]
[ext_resource type="ArrayMesh" uid="uid://cqyqrhn8dc6bq" path="res://demos/resources/ring.obj" id="2"]
[ext_resource type="PackedScene" path="res://demos/components/ShowAllDemos.tscn" id="3"]
[ext_resource type="PackedScene" uid="uid://cjhef5i5fkw3d" path="res://tests/Box.tscn" id="4"]

Expand Down
2 changes: 1 addition & 1 deletion demos/AnimationsPreview.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func create_new_header(text: String) -> PanelContainer:

label.set_text(text.replace('_', ' ').capitalize())
container.add_child(label)

var style := StyleBoxFlat.new()
style.bg_color = Color('#404553')
style.content_margin_top = 12
Expand Down
17 changes: 5 additions & 12 deletions demos/nodes/Popup.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ script = ExtResource("2")

[node name="Panel" type="Panel" parent="Popup"]
custom_minimum_size = Vector2(600, 400)
offset_left = 276.0
offset_top = 124.0
offset_right = 876.0
offset_bottom = 524.0
layout_mode = 2

[node name="MarginContainer" type="MarginContainer" parent="Popup/Panel"]
anchors_preset = 15
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = 12.0
Expand All @@ -28,25 +25,21 @@ offset_right = -12.0
offset_bottom = -12.0

[node name="Label" type="Label" parent="Popup/Panel/MarginContainer"]
offset_right = 576.0
offset_bottom = 376.0
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 7
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
autowrap_mode = 3

[node name="CenterContainer" type="CenterContainer" parent="Popup/Panel"]
anchors_preset = -1
layout_mode = 0
anchor_top = 0.745
anchor_right = 1.0
anchor_bottom = 0.869
offset_bottom = 40.0

[node name="Button" type="Button" parent="Popup/Panel/CenterContainer"]
offset_left = 261.0
offset_top = 29.0
offset_right = 339.0
offset_bottom = 60.0
layout_mode = 2
mouse_default_cursor_shape = 2
text = "Close Me"

Expand Down
2 changes: 0 additions & 2 deletions demos/nodes/SequenceCallback.gd
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ func _on_button_completed(index: int) -> void:

anima.play()
_check_sprites[index - 1].play()


2 changes: 1 addition & 1 deletion demos/nodes/SequenceCallback.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://8u1vktammhcn"]

[ext_resource type="Script" path="res://demos/nodes/SequenceCallback.gd" id="2"]
[ext_resource type="Texture2D" uid="uid://bo50sbgp0cq1b" path="res://demos/resources/check.png" id="3"]
[ext_resource type="Texture2D" uid="uid://c366xnjxgfihg" path="res://demos/resources/check.png" id="3"]
[ext_resource type="PackedScene" path="res://demos/components/ShowAllDemos.tscn" id="4"]

[node name="Node" type="VBoxContainer"]
Expand Down
20 changes: 0 additions & 20 deletions docs/.gitignore

This file was deleted.

3 changes: 3 additions & 0 deletions docs/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "themes/lotusdocs"]
path = themes/lotusdocs
url = https://github.com/colinwilson/lotusdocs
File renamed without changes.
41 changes: 0 additions & 41 deletions docs/README.md

This file was deleted.

5 changes: 5 additions & 0 deletions docs/archetypes/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ .Date }}
draft = true
+++
Binary file added docs/assets/images/activate-anima.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/asset-library.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added docs/assets/images/hero.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/assets/images/social/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
11 changes: 11 additions & 0 deletions docs/assets/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"*": [
"../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2@v2.21100.20000/package/dist/cjs/*",
"../../../../Library/Caches/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/*"
]
}
}
}
3 changes: 0 additions & 3 deletions docs/babel.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions docs/content/docs/anima/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
weight: 200
title: "Anima Addon"
description: "Anima addon structure and usage"
icon: "folder"
draft: false
---

Loading

0 comments on commit ec9ddc2

Please sign in to comment.