str1ke Posted December 21, 2016 Share Posted December 21, 2016 Hey people, I'm new to panda and just started playing around. So if I change the picture of the default main.js it shows just fine, but as soon as I try to use an animation (same code as from the official example) I just see the background. Only thing I changed is the pictures (my own and from 3 pics to 2 pics). Has anyone a clue why that might happen? I downloaded the latest version of pandajs and used the local webbrowser of WebStorm IDE, but also tried Apache Web Server. But no difference. Thx for your help. game.module( 'game.main' ) .body(function() { game.createScene('Main', { backgroundColor: 0xb9bec7, init: function() { var anim = new game.Animation('1.png', '2.png'); anim.animationSpeed = 0.2; anim.play(); anim.addTo(game.scene.stage); } }); }); Quote Link to comment Share on other sites More sharing options...
Stephan Posted December 23, 2016 Share Posted December 23, 2016 Hi str1ke, You need to load the images in the texture cache before you can use them in an animation. Have a look at the panda fiddler for working examples. http://vermeire.home.xs4all.nl/panda/ (stable version, v1!) i alse recommend to use chrome for testing so you can hit f12 For debugging purposes. Stephan Quote Link to comment Share on other sites More sharing options...
str1ke Posted December 24, 2016 Author Share Posted December 24, 2016 Thank you, Stephan! Actually I am not only new to panda but also to Java Script in general and I didn't think about the Java Script console. Hitting F12 quickly revealed my mistake. I assumed that I can just put my pictures in the media subdirectory, because that's how it was for the example code that was included when I downloaded panda from pandajs.net. That seems to work for static images but not for animations. I just put the pictures in the root directory and it worked without any further changes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.