added in sprite wobble

This commit is contained in:
2025-07-19 05:54:34 +10:00
parent 92f7eb6da4
commit 736db0e160
5 changed files with 146 additions and 73 deletions

View File

@@ -20,6 +20,8 @@ var default = {
"xFrq": 0.002,
"yAmp": 11,
"yFrq": 0.004,
"rAmp": 0,
"rFrq": 0.0,
"zindex": -1 },
"1": {
"drag": 1,
@@ -36,8 +38,10 @@ var default = {
"xFrq": 0,
"yAmp": 0,
"yFrq": 0,
"rAmp": 0,
"rFrq": 0.0,
"zindex": 0 },
"2": { "drag": 4, "identification": 928082759, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/hair.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": -2 }, "3": { "drag": 0, "identification": 346749260, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "4": { "drag": 0, "identification": 348929106, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "5": { "drag": 0, "identification": 66364456, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "6": { "drag": 0, "identification": 261040117, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "7": { "drag": 0, "identification": 291459997, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye3.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 2, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 }, "8": { "drag": 0, "identification": 148065686, "offset": "Vector2(-74, 92)", "parentId": 456157398, "path": "user://defaultAvatar/hat.png", "pos": "Vector2(72, -89)", "rotDrag": -2, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 2 } }
"2": { "drag": 4, "identification": 928082759, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/hair.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": -2 }, "3": { "drag": 0, "identification": 346749260, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 0 }, "4": { "drag": 0, "identification": 348929106, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 0 }, "5": { "drag": 0, "identification": 66364456, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 2, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 0 }, "6": { "drag": 0, "identification": 261040117, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 1, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 0 }, "7": { "drag": 0, "identification": 291459997, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye3.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 2, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 0 }, "8": { "drag": 0, "identification": 148065686, "offset": "Vector2(-74, 92)", "parentId": 456157398, "path": "user://defaultAvatar/hat.png", "pos": "Vector2(72, -89)", "rotDrag": -2, "showBlink": 0, "showTalk": 0, "type": "sprite", "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "rAmp": 0, "rFrq": 0.0, "zindex": 2 } }
var settings = {

View File

@@ -324,6 +324,12 @@ func _on_load_dialog_file_selected(path):
sprite.yFrq = data[item]["yFrq"]
sprite.yAmp = data[item]["yAmp"]
# Load rotation wobble properties (with backward compatibility)
if data[item].has("rFrq"):
sprite.rFrq = data[item]["rFrq"]
if data[item].has("rAmp"):
sprite.rAmp = data[item]["rAmp"]
sprite.rdragStr = data[item]["rotDrag"]
sprite.showOnTalk = data[item]["showTalk"]
@@ -394,6 +400,9 @@ func _on_save_dialog_file_selected(path):
data[id]["yFrq"] = child.yFrq
data[id]["yAmp"] = child.yAmp
data[id]["rFrq"] = child.rFrq
data[id]["rAmp"] = child.rAmp
data[id]["rotDrag"] = child.rdragStr
data[id]["showTalk"] = child.showOnTalk
@@ -476,6 +485,9 @@ func _on_duplicate_button_pressed():
sprite.yFrq = Global.heldSprite.yFrq
sprite.yAmp = Global.heldSprite.yAmp
sprite.rFrq = Global.heldSprite.rFrq
sprite.rAmp = Global.heldSprite.rAmp
sprite.rdragStr = Global.heldSprite.rdragStr
sprite.offset = Global.heldSprite.offset
@@ -535,7 +547,7 @@ func moveSpriteMenu(delta):
var size = get_viewport().get_visible_rect().size
var windowLength = 1250 #1187
var windowLength = 1400
$ViewerArrows/Arrows.position.y = size.y - 25

View File

@@ -55,6 +55,10 @@ var xAmp = 0.0
var yFrq = 0.0
var yAmp = 0.0
#Rotation Wobble
var rFrq = 0.0
var rAmp = 0.0
#Rotational Drag
var rdragStr = 0
var rLimitMax = 180
@@ -331,10 +335,14 @@ func rotationalDrag(length,delta):
var yvel = (length * rdragStr)
#Calculate Max angle
yvel = clamp(yvel,rLimitMin,rLimitMax)
sprite.rotation = lerp_angle(sprite.rotation,deg_to_rad(yvel),0.25)
# Add rotation wobble as percentage of rotational limits range
var rotationRange = rLimitMax - rLimitMin
var rotationWobble = sin(tick*rFrq) * (rotationRange * rAmp * 0.01)
var totalRotation = yvel + rotationWobble
sprite.rotation = lerp_angle(sprite.rotation,deg_to_rad(totalRotation),0.25)
func stretch(length,delta):
var yvel = (length * stretchAmount * 0.01)

View File

@@ -42,6 +42,12 @@ func setImage():
$WobbleControl/yFrq.value = Global.heldSprite.yFrq
$WobbleControl/yAmp.value = Global.heldSprite.yAmp
$WobbleControl/rFrqLabel.text = "rotation frequency: " + str(Global.heldSprite.rFrq)
$WobbleControl/rAmpLabel.text = "rotation percentage: " + str(Global.heldSprite.rAmp) + "%"
$WobbleControl/rFrq.value = Global.heldSprite.rFrq
$WobbleControl/rAmp.value = Global.heldSprite.rAmp
$Rotation/rDragLabel.text = "rotational drag: " + str(Global.heldSprite.rdragStr)
$Rotation/rDrag.value = Global.heldSprite.rdragStr
@@ -139,6 +145,15 @@ func _on_y_amp_value_changed(value):
Global.heldSprite.yAmp = value
func _on_r_frq_value_changed(value):
$WobbleControl/rFrqLabel.text = "rotation frequency: " + str(value)
Global.heldSprite.rFrq = value
func _on_r_amp_value_changed(value):
$WobbleControl/rAmpLabel.text = "rotation amplitude: " + str(value) + "%"
Global.heldSprite.rAmp = value
func _on_r_drag_value_changed(value):
$Rotation/rDragLabel.text = "rotational drag: " + str(value)
Global.heldSprite.rdragStr = value

File diff suppressed because one or more lines are too long