Jump to content

Is there any info on what I can do to spine animations?


mkit
 Share

Recommended Posts

Struggling to remove an element of a Spine animation and wondered if there is any documentation to assist me.

 

I tried the following with no success to attempt to remove the HiddenCarrot element :(

function animate() {         requestAnimFrame(animate);             // render the stage     renderer.render(stage);if (boolAnimationPlaying == true) {           var boolComplete = bedroomTableDrawer.state.isComplete();   console.log("boolComplete = " + boolComplete);   if (boolComplete == true) {             bedroomTableDrawer.skeleton.findSlot("HiddenCarrot").setAttachment(null);          boolAnimationPlaying = false;                    }}

I have been supplied this spine data from my client and I am not familiar with spine but from what I can see in the spine data, it appears to set the attachment for the HiddenCarrot slot when the animation starts playing.

 

Here is a test file I have uploaded where I am successfully removing another element of the table but not the carrot

 

http://www.flash-developer.co.uk/testarea/testRemoveElement.html

 

 

 

 

 

Also is there a possible bug in the setAttachment: function due to it using the following code:

for (var i = 0, n = slots.size; i < n; i++) { 

Should it not be the following?

for (var i = 0, n = slots.length; i < n; i++) { 
Here is the spine data
 
{"bones": [	{ "name": "root-Table" },	{ "name": "Drawer-bone", "parent": "root-Table", "length": 37.46, "x": 311.84, "y": -41.04, "rotation": -7.68 },	{		"name": "Carrot_Table-bone",		"parent": "Drawer-bone",		"length": 101.2,		"x": 30.07,		"y": 13.82,		"scaleX": 0.5,		"scaleY": 0.5,		"rotation": -161.31	}],"slots": [	{ "name": "Bedroom_Table", "bone": "root-Table", "attachment": "Bedroom_Table" },	{ "name": "Bedroom_Table-Drawer", "bone": "Drawer-bone", "attachment": "Bedroom_Table-Drawer" },	{ "name": "Bedroom_Table-DrawerOverlay", "bone": "Drawer-bone", "attachment": "Bedroom_Table-DrawerOverlay" },	{ "name": "Bedroom_Table-Cover", "bone": "root-Table", "attachment": "Bedroom_Table-Cover" },	{ "name": "HiddenCarrot", "bone": "Carrot_Table-bone" }],"skins": {	"default": {		"Bedroom_Table": {			"Bedroom_Table": { "x": 344, "y": -84, "width": 178, "height": 190 }		},		"Bedroom_Table-Cover": {			"Bedroom_Table-Cover": { "x": 344, "y": -84, "width": 178, "height": 190 }		},		"Bedroom_Table-Drawer": {			"Bedroom_Table-Drawer": { "x": 27.19, "y": 11.74, "rotation": 7.68, "width": 136, "height": 61 }		},		"Bedroom_Table-DrawerOverlay": {			"Bedroom_Table-DrawerOverlay": { "x": 27.19, "y": 11.74, "rotation": 7.68, "width": 136, "height": 61 }		},		"HiddenCarrot": {			"HiddenCarrot": { "x": 6.95, "y": -16.63, "rotation": 169, "width": 216, "height": 103 },			"HiddenCarrot-masked1": { "x": 6.95, "y": -16.63, "rotation": 169, "width": 216, "height": 103 },			"HiddenCarrot-masked2": { "x": 6.95, "y": -16.63, "rotation": 169, "width": 216, "height": 103 }		}	}},"animations": {	"animation": {		"slots": {			"HiddenCarrot": {				"attachment": [					{ "time": 0, "name": "HiddenCarrot" }				]			}		},		"bones": {			"Drawer-bone": {				"rotate": [					{ "time": 0, "angle": 0 }				],				"translate": [					{						"time": 0,						"x": 0,						"y": 0,						"curve": [ 0.358, 0.01, 0.538, 1 ]					},					{						"time": 0.1666,						"x": 1.56,						"y": 0.6,						"curve": [ 0.45, 0, 0.518, 0.97 ]					},					{						"time": 0.6666,						"x": -46.57,						"y": -16.21,						"curve": [ 0.312, 0.01, 0.544, 1 ]					},					{ "time": 0.8333, "x": -45.47, "y": -15.47 }				]			},			"Carrot_Table-bone": {				"rotate": [					{						"time": 1,						"angle": 0,						"curve": [ 0.25, 0, 0.955, 0.42 ]					},					{ "time": 1.1666, "angle": -14.29 },					{						"time": 1.2,						"angle": 340.68,						"curve": [ 0.138, 0.7, 0.75, 1 ]					},					{						"time": 1.3333,						"angle": 337.09,						"curve": [ 0.378, 0.01, 0.53, 0.94 ]					},					{ "time": 1.4666, "angle": -22.9 }				],				"translate": [					{						"time": 1,						"x": 0,						"y": 0,						"curve": [ 0.25, 0, 0.955, 0.42 ]					},					{ "time": 1.1666, "x": -1, "y": 4.69 },					{						"time": 1.2,						"x": -6.24,						"y": 18.84,						"curve": [ 0.138, 0.7, 0.75, 1 ]					},					{						"time": 1.3333,						"x": -14.82,						"y": 32.91,						"curve": [ 0.378, 0.01, 0.53, 0.94 ]					},					{ "time": 1.4666, "x": -14.52, "y": 30.72 }				]			}		},		"draworder": [			{				"time": 0,				"offsets": [					{ "slot": "HiddenCarrot", "offset": -2 }				]			},			{ "time": 1.184 }		]	}}}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...