-
Notifications
You must be signed in to change notification settings - Fork 315
/
LN_tween_transform.py
67 lines (58 loc) · 2.79 KB
/
LN_tween_transform.py
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
from arm.logicnode.arm_nodes import *
class TweenTransformNode(ArmLogicTreeNode):
"""Tween Transform.
@input Start: Start tweening
@input Stop: Stop a tweening. tweening can be re-started via the `Start`input
@input From: Tween start value
@input To: Tween final value
@input Duration: Duartion of the tween in seconds
@output Out: Executed immidiately after `Start` or `Stop` is called
@output Tick: Executed at every time step in the tween duration
@output Done: Executed when tween is successfully completed. Not executed if tweening is stopped mid-way
@output Value: Current tween value
"""
bl_idname = 'LNTweenTransformNode'
bl_label = 'Tween Transform'
arm_version = 1
property0: HaxeEnumProperty(
'property0',
items = [('Linear', 'Linear', 'Linear'),
('SineIn', 'SineIn', 'SineIn'),
('SineOut', 'SineOut', 'SineOut'),
('SineInOut', 'SineInOut', 'SineInOut'),
('QuadIn', 'QuadIn', 'QuadIn'),
('QuadOut', 'QuadOut', 'QuadOut'),
('QuadInOut', 'QuadInOut', 'QuadInOut'),
('CubicIn', 'CubicIn', 'CubicIn'),
('CubicOut', 'CubicOut', 'CubicOut'),
('CubicInOut', 'CubicInOut', 'CubicInOut'),
('QuartIn', 'QuartIn', 'QuartIn'),
('QuartOut', 'QuartOut', 'QuartOut'),
('QuartInOut', 'QuartInOut', 'QuartInOut'),
('QuintIn', 'QuintIn', 'QuintIn'),
('QuintOut', 'QuintOut', 'QuintOut'),
('QuintInOut', 'QuintInOut', 'QuintInOut'),
('ExpoIn', 'ExpoIn', 'ExpoIn'),
('ExpoOut', 'ExpoOut', 'ExpoOut'),
('ExpoInOut', 'ExpoInOut', 'ExpoInOut'),
('CircIn', 'CircIn', 'CircIn'),
('CircOut', 'CircOut', 'CircOut'),
('CircInOut', 'CircInOut', 'CircInOut'),
('BackIn', 'BackIn', 'BackIn'),
('BackOut', 'BackOut', 'BackOut'),
('BackInOut', 'BackInOut', 'BackInOut')],
name='', default='Linear')
def arm_init(self, context):
self.add_input('ArmNodeSocketAction', 'Start')
self.add_input('ArmNodeSocketAction', 'Stop')
self.add_input('ArmDynamicSocket', 'From')
self.add_input('ArmDynamicSocket', 'To')
self.add_input('ArmFloatSocket', 'Duration', default_value=1.0)
self.add_output('ArmNodeSocketAction', 'Out')
self.add_output('ArmNodeSocketAction', 'Tick')
self.add_output('ArmNodeSocketAction', 'Done')
self.add_output('ArmDynamicSocket', 'Value')
def draw_buttons(self, context, layout):
layout.prop(self, 'property0')
def draw_label(self) -> str:
return f'{self.bl_label}: {self.property0}'