JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<canvas id="canvas" width="700" height="500" style="background-color:#fff"></canvas>
JavaScript
var canvas, stage, exportRoot;
function init() {
// --- write your JS code here ---
canvas = document.getElementById("canvas");
exportRoot = new lib.gtStopTest();
stage = new createjs.Stage(canvas);
stage.addChild(exportRoot);
stage.update();
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
//this is added dynamically but the stage is not updated before the goto call
var testMC3 = new lib.ParentOfSquare();
testMC3.x= 430;
testMC3.y = 140;
exportRoot.addChild(testMC3);
testMC3.square_mc.gotoAndStop(0);
//this is added dynamically but the stage IS updated before the goto call
var testMC2 = new lib.ParentOfSquare();
testMC2.x= 40;
testMC2.y = 220;
exportRoot.addChild(testMC2);
stage.update();
testMC2.square_mc.gotoAndStop(0);
}
window.onload = function() {
init();
};
//--- js export
(function (lib, img, cjs, ss) {
var p; // shortcut to reference prototypes
lib.webFontTxtFilters = {};
// library properties:
lib.properties = {
width: 700,
height: 400,
fps: 12,
color: "#FFFFFF",
webfonts: {},
manifest: []
};
lib.webfontAvailable = function(family) {
lib.properties.webfonts[family] = true;
var txtFilters = lib.webFontTxtFilters && lib.webFontTxtFilters[family] || [];
for(var f = 0; f < txtFilters.length; ++f) {
txtFilters[f].updateCache();
}
};
// symbols:
(lib.Square = function(mode,startPosition,loop) {
this.initialize(mode,startPosition,loop,{});
// timeline functions:
this.frame_0 = function() {
//this.gotoAndStop(3);
this.stop();
}
// actions tween:
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(6));
// Layer 1
this.shape = new cjs.Shape();
this.shape.graphics.f().s("#000000").ss(1,1,1).p("Ag+g+IB9AAIAAB9Ih9AAg");
this.shape.setTransform(6.4,6.4);
this.shape_1 = new cjs.Shape();
this.shape_1.graphics.f("#CC0000").s().p("Ag+A/IAAh9IB9AAIAAB9g");
this.shape_1.setTransform(6.4,6.4);
this.shape_2 = new...