Toggle navigation
Sign Up
Log In
Explore
Works
Folders
Tools
Collections
Artists
Groups
Groups
Topics
Tasks
Tasks
Jobs
Teams
Jobs
Recommendation
More Effects...
JS
$(window).load(function () { init(); }); function init() { createJSInit(); } var canvas; var stage; var texture; var textureData; var skeletonData; function createJSInit() { canvas = document.getElementById("canvas"); stage = new createjs.Stage(canvas); texture = new Image(); texture.onload = function() { $.getJSON( "http://www.effecthub.com/uploads/codefile/AF72E054-A9B6-521C-F1CB-C433760E6003/texture.json", function(data) { textureData = data; $.getJSON( "http://www.effecthub.com/uploads/codefile/D7FBFFDA-0510-7B51-C43C-8AC04901D0B5/skeleton.json", function(data) { skeletonData = data; dragonBonesInit(); } ) } ); } texture.src = "http://www.effecthub.com/uploads/codefile/8B29BEF7-DAC6-33D4-6EF0-14572F46D439/texture.png"; } var factory; var armature; function dragonBonesInit() { factory = new dragonBones.factorys.CreateJSFactory(); factory.addSkeletonData(dragonBones.objects.DataParser.parseSkeletonData(skeletonData)); factory.addTextureAtlas(new dragonBones.textures.CreateJSTextureAtlas(texture, textureData)); armature = factory.buildArmature("robot"); armature.getDisplay().x = 400; armature.getDisplay().y = 400; changeAnimation(); dragonBones.animation.WorldClock.clock.add(armature); stage.addChild(armature.getDisplay()); createjs.Ticker.setFPS(60); createjs.Ticker.addEventListener("tick", update); canvas.onclick = changeAnimation; } function update() { dragonBones.animation.WorldClock.clock.advanceTime(1/60); stage.update(); } function changeAnimation() { do { var animationName = armature.animation.animationNameList[Math.floor(Math.random() * armature.animation.animationNameList.length)]; } while (animationName == armature.animation.getLastAnimationName()); armature.animation.gotoAndPlay(animationName); }
CSS
body{ background:#F0F0ED; }
HTML
Join Effecthub.com
Working with Global Gaming Artists and Developers!
Login
Sign Up
Or Login with Your Email Address:
Email
Password
Remember
Or Sign Up with Your Email Address:
Your Email
This field must contain a valid email
Set Password
Password should be at least 1 character
Stay informed via email