wwfc
08-26-2015, 03:04 PM
hi all,
i am working on something that i am using sprite sequencer and sprite rollover scripts for.
at the moment it plays the sprite animation just fine - but what i want to do is to play the sprites as a loop not just from the first frame to the last - so it looks like a constant movement...
ideally the rollover would trigger the sprite sequence to play and loop until the mouse moves out of the area - and then the sprites would carry on until a specific frame (either first or last of the sprite sheet)...
how do i declare this in the following code?
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#sprite').spriteSequencer({
spriteSheet: "sprite_sheet.png",
columns: 30,
totalFrames: 30,
fps: 30,
width: 500,
height: 281,
onTick: currentFrame
})
$('#play').click(function() {
$('#sprite').spriteSequencer('loop')
});
$('#pause').click(function() {
$('#sprite').spriteSequencer('pause')
});
$('#gotostop').click(function() {
$('#sprite').spriteSequencer('gotoAndStop', {frame: 20})
});
$('#gotoplay').click(function() {
$('#sprite').spriteSequencer('gotoAndPlay', {frame: 10})
});
$('#playto').click(function() {
$('#sprite').spriteSequencer('playTo', {frame: 5})
});
});
function currentFrame (frame) {
$('#current-frame').html("Current frame: "+ frame)
}
</script>
any ideas? hope that i'm not being too vague - but the code above is basically the thing that drives it all...
here's hoping!
;-)
i am working on something that i am using sprite sequencer and sprite rollover scripts for.
at the moment it plays the sprite animation just fine - but what i want to do is to play the sprites as a loop not just from the first frame to the last - so it looks like a constant movement...
ideally the rollover would trigger the sprite sequence to play and loop until the mouse moves out of the area - and then the sprites would carry on until a specific frame (either first or last of the sprite sheet)...
how do i declare this in the following code?
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#sprite').spriteSequencer({
spriteSheet: "sprite_sheet.png",
columns: 30,
totalFrames: 30,
fps: 30,
width: 500,
height: 281,
onTick: currentFrame
})
$('#play').click(function() {
$('#sprite').spriteSequencer('loop')
});
$('#pause').click(function() {
$('#sprite').spriteSequencer('pause')
});
$('#gotostop').click(function() {
$('#sprite').spriteSequencer('gotoAndStop', {frame: 20})
});
$('#gotoplay').click(function() {
$('#sprite').spriteSequencer('gotoAndPlay', {frame: 10})
});
$('#playto').click(function() {
$('#sprite').spriteSequencer('playTo', {frame: 5})
});
});
function currentFrame (frame) {
$('#current-frame').html("Current frame: "+ frame)
}
</script>
any ideas? hope that i'm not being too vague - but the code above is basically the thing that drives it all...
here's hoping!
;-)