-3

I am working on a game, that involves a snake moving across the screen. The Following script works but i found it online, so am unsure of what exactly it does

var btn = new createjs.MovieClip(null, null, false, {
    up:0,over:10,down:60, out:0
}).set({
    x:250, y:570
});


createjs.Tween
    .get(o)
    .to({_off:true})
    .wait(10)
    .to({_off:false})
    .wait(10)
    .to({_off:true}),
JakeParis
  • 11,056
  • 3
  • 42
  • 65
MrScotia
  • 1
  • 2

1 Answers1

0

This is likely code exported from Adobe Animate. Animate uses CreateJS to display MovieClips with labels and timeline animations.

The first block is creating a MovieClip instance with 4 keyframes (up, over, down, out), and specifying the keyframes they are at.

Then it sets the visual x/y coordinates (likely where the clip was placed in the Animate stage).

The Tween describes a timeline where an instance is made visible/invisible every 10 "ticks/frames". The _off property is a special case used to toggle whether the instance is on stage or not. Note that this is applied to an instance named o, and not the btn instance in the first part of the code.

Animate exported content is not really meant to be fully understandable, since it is auto-generated based on the Animate document.

Lanny
  • 11,244
  • 1
  • 22
  • 30