1
Scripting / Re: Problem writing magic token functions [SOLVED]
« on: March 03, 2017, 11:00:56 PM »
Brilliant, works like a dream! I've tried it with image, sprite and text elements and it works perfectly. Here's the sprite code:
Thanks heaps: I've learned a lot, hopefully this might help others out too.
Code: [Select]
local artwork = fe.add_image("staticsprite.png", 1000, 100, blip*0.405, blip*0.2 );
//sprite animation - use a spritesheet to animate specific frames of the sprite sheet
local sprite_cfg = {
when = When.Always,
width = 462,
height = 200,
frame = 0,
time = 3000,
order = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
loop = true
}
animation.add( SpriteAnimation( artwork, sprite_cfg ) );
// Create transition that will toggle artwork visibility
fe.add_transition_callback("updateArtwork");
function updateArtwork(ttype, var, transition_time) {
if ((ttype == Transition.StartLayout) || (ttype == Transition.ToNewList) || (ttype == Transition.EndNavigation)){
artwork.visible = randBool();
}
}
Thanks heaps: I've learned a lot, hopefully this might help others out too.