Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Как размножить анимированную кнопку 
:(
    Опции темы
xber9
Дата 2.4.2019, 11:24 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Бывалый
*


Профиль
Группа: Участник
Сообщений: 245
Регистрация: 21.1.2007

Репутация: нет
Всего: нет



Народ подскажите 
вот сделал  кнопку в adobe animate cc, опубликовал как html5\canvas и  разместил на странице
Вопрос как разместить несколько  таких кнопок  на одной странице желательно не переписывая кучу js кода ?
вот код анимации

Код

<!DOCTYPE html>
<!--
    NOTES:
    1. All tokens are represented by '$' sign in the template.
    2. You can write your code only wherever mentioned.
    3. All occurrences of existing tokens will be replaced by their appropriate values.
    4. Blank lines will be removed automatically.
    5. Remove unnecessary comments before creating your template.
-->
<html>
<head>
<meta charset="UTF-8">
<meta name="authoring-tool" content="Adobe_Animate_CC">
<title>3</title>
<!-- write your code here -->
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script src="3.js"></script>
<script>
var canvas, stage, exportRoot, anim_container, dom_overlay_container, fnStartAnimation;
function init() {
    canvas = document.getElementById("canvas");
    anim_container = document.getElementById("animation_container");
    dom_overlay_container = document.getElementById("dom_overlay_container");
    var comp=AdobeAn.getComposition("65C65D0DCD45AC4B84C44760FFE9AFB2");
    var lib=comp.getLibrary();
    var loader = new createjs.LoadQueue(false);
    loader.addEventListener("fileload", function(evt){handleFileLoad(evt,comp)});
    loader.addEventListener("complete", function(evt){handleComplete(evt,comp)});
    var lib=comp.getLibrary();
    loader.loadManifest(lib.properties.manifest);
}
function handleFileLoad(evt, comp) {
    var images=comp.getImages();    
    if (evt && (evt.item.type == "image")) { images[evt.item.id] = evt.result; }    
}
function handleComplete(evt,comp) {
    //This function is always called, irrespective of the content. You can use the variable "stage" after it is created in token create_stage.
    var lib=comp.getLibrary();
    var ss=comp.getSpriteSheet();
    var queue = evt.target;
    var ssMetadata = lib.ssMetadata;
    for(i=0; i<ssMetadata.length; i++) {
        ss[ssMetadata[i].name] = new createjs.SpriteSheet( {"images": [queue.getResult(ssMetadata[i].name)], "frames": ssMetadata[i].frames} )
    }
    exportRoot = new lib._3();
    stage = new lib.Stage(canvas);
    stage.enableMouseOver();    
    //Registers the "tick" event listener.
    fnStartAnimation = function() {
        stage.addChild(exportRoot);
        createjs.Ticker.setFPS(lib.properties.fps);
        createjs.Ticker.addEventListener("tick", stage)
        stage.addEventListener("tick", handleTick)
        function getProjectionMatrix(container, totalDepth) {
            var focalLength = 528.25;
            var projectionCenter = { x : lib.properties.width/2, y : lib.properties.height/2 };
            var scale = (totalDepth + focalLength)/focalLength;
            var scaleMat = new createjs.Matrix2D;
            scaleMat.a = 1/scale;
            scaleMat.d = 1/scale;
            var projMat = new createjs.Matrix2D;
            projMat.tx = -projectionCenter.x;
            projMat.ty = -projectionCenter.y;
            projMat = projMat.prependMatrix(scaleMat);
            projMat.tx += projectionCenter.x;
            projMat.ty += projectionCenter.y;
            return projMat;
        }
        function handleTick(event) {
            var cameraInstance = exportRoot.___camera___instance;
            if(cameraInstance !== undefined && cameraInstance.pinToObject !== undefined)
            {
                cameraInstance.x = cameraInstance.pinToObject.x + cameraInstance.pinToObject.pinOffsetX;
                cameraInstance.y = cameraInstance.pinToObject.y + cameraInstance.pinToObject.pinOffsetY;
                if(cameraInstance.pinToObject.parent !== undefined && cameraInstance.pinToObject.parent.depth !== undefined)
                cameraInstance.depth = cameraInstance.pinToObject.parent.depth + cameraInstance.pinToObject.pinOffsetZ;
            }
            applyLayerZDepth(exportRoot);
        }
        function applyLayerZDepth(parent)
        {
            var cameraInstance = parent.___camera___instance;
            var focalLength = 528.25;
            var projectionCenter = { 'x' : 0, 'y' : 0};
            if(parent === exportRoot)
            {
                var stageCenter = { 'x' : lib.properties.width/2, 'y' : lib.properties.height/2 };
                projectionCenter.x = stageCenter.x;
                projectionCenter.y = stageCenter.y;
            }
            for(child in parent.children)
            {
                var layerObj = parent.children[child];
                if(layerObj == cameraInstance)
                    continue;
                applyLayerZDepth(layerObj, cameraInstance);
                if(layerObj.layerDepth === undefined)
                    continue;
                if(layerObj.currentFrame != layerObj.parent.currentFrame)
                {
                    layerObj.gotoAndPlay(layerObj.parent.currentFrame);
                }
                var matToApply = new createjs.Matrix2D;
                var cameraMat = new createjs.Matrix2D;
                var totalDepth = layerObj.layerDepth ? layerObj.layerDepth : 0;
                var cameraDepth = 0;
                if(cameraInstance && !layerObj.isAttachedToCamera)
                {
                    var mat = cameraInstance.getMatrix();
                    mat.tx -= projectionCenter.x;
                    mat.ty -= projectionCenter.y;
                    cameraMat = mat.invert();
                    cameraMat.prependTransform(projectionCenter.x, projectionCenter.y, 1, 1, 0, 0, 0, 0, 0);
                    cameraMat.appendTransform(-projectionCenter.x, -projectionCenter.y, 1, 1, 0, 0, 0, 0, 0);
                    if(cameraInstance.depth)
                        cameraDepth = cameraInstance.depth;
                }
                if(layerObj.depth)
                {
                    totalDepth = layerObj.depth;
                }
                //Offset by camera depth
                totalDepth -= cameraDepth;
                if(totalDepth < -focalLength)
                {
                    matToApply.a = 0;
                    matToApply.d = 0;
                }
                else
                {
                    if(layerObj.layerDepth)
                    {
                        var sizeLockedMat = getProjectionMatrix(parent, layerObj.layerDepth);
                        if(sizeLockedMat)
                        {
                            sizeLockedMat.invert();
                            matToApply.prependMatrix(sizeLockedMat);
                        }
                    }
                    matToApply.prependMatrix(cameraMat);
                    var projMat = getProjectionMatrix(parent, totalDepth);
                    if(projMat)
                    {
                        matToApply.prependMatrix(projMat);
                    }
                }
                layerObj.transformMatrix = matToApply;
            }
        }
    }        
    //Code to support hidpi screens and responsive scaling.
    function makeResponsive(isResp, respDim, isScale, scaleType) {        
        var lastW, lastH, lastS=1;        
        window.addEventListener('resize', resizeCanvas);        
        resizeCanvas();        
        function resizeCanvas() {            
            var w = lib.properties.width, h = lib.properties.height;            
            var iw = window.innerWidth, ih=window.innerHeight;            
            var pRatio = window.devicePixelRatio || 1, xRatio=iw/w, yRatio=ih/h, sRatio=1;            
            if(isResp) {                
                if((respDim=='width'&&lastW==iw) || (respDim=='height'&&lastH==ih)) {                    
                    sRatio = lastS;                
                }                
                else if(!isScale) {                    
                    if(iw<w || ih<h)                        
                        sRatio = Math.min(xRatio, yRatio);                
                }                
                else if(scaleType==1) {                    
                    sRatio = Math.min(xRatio, yRatio);                
                }                
                else if(scaleType==2) {                    
                    sRatio = Math.max(xRatio, yRatio);                
                }            
            }            
            canvas.width = w*pRatio*sRatio;            
            canvas.height = h*pRatio*sRatio;
            canvas.style.width = dom_overlay_container.style.width = anim_container.style.width =  w*sRatio+'px';                
            canvas.style.height = anim_container.style.height = dom_overlay_container.style.height = h*sRatio+'px';
            stage.scaleX = pRatio*sRatio;            
            stage.scaleY = pRatio*sRatio;            
            lastW = iw; lastH = ih; lastS = sRatio;            
            stage.tickOnUpdate = false;            
            stage.update();            
            stage.tickOnUpdate = true;        
        }
    }
    makeResponsive(true,'both',false,1);    
    AdobeAn.compositionLoaded(lib.properties.id);
    fnStartAnimation();
}
</script>
<!-- write your code here -->
    </head>
<body onload="init();" style="margin:0px;">
    <div id="o">
    <div id="animation_container" style=" width:800px; height:800px">
        <canvas id="canvas" width="800" height="800" style="position: absolute; display: block;"></canvas>
        <div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:800px; height:800px; position: absolute; left: 0px; top: 0px; display: block;">
        </div>
    </div>
        
        </div>
    
    </body>
</html>


содержимое "3.js"
Код


(function (cjs, an) {

var p; // shortcut to reference prototypes
var lib={};var ss={};var img={};
lib.ssMetadata = [
        {name:"3_atlas_", frames: [[0,0,1593,1594]]},
        {name:"3_atlas_2", frames: [[0,0,1583,1583]]},
        {name:"3_atlas_3", frames: [[802,0,201,280],[0,0,800,800]]}
];

// symbols:


(lib.butonfon = function() {
    this.initialize(ss["3_atlas_3"]);
    this.gotoAndStop(0);
}).prototype = p = new cjs.Sprite();


(lib.CachedTexturedBitmap_1 = function() {
    this.initialize(img.CachedTexturedBitmap_1);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,2474,2903);

(lib.CachedTexturedBitmap_4 = function() {
    this.initialize(ss["3_atlas_2"]);
    this.gotoAndStop(0);
}).prototype = p = new cjs.Sprite();


(lib.CachedTexturedBitmap_7 = function() {
    this.initialize(ss["3_atlas_"]);
    this.gotoAndStop(0);
}).prototype = p = new cjs.Sprite();


(lib.koin = function() {
    this.initialize(ss["3_atlas_3"]);
    this.gotoAndStop(1);
}).prototype = p = new cjs.Sprite();
// helper functions:

function mc_symbol_clone() {
    var clone = this._cloneProps(new this.constructor(this.mode, this.startPosition, this.loop));
    clone.gotoAndStop(this.currentFrame);
    clone.paused = this.paused;
    clone.framerate = this.framerate;
    return clone;
}

function getMCSymbolPrototype(symbol, nominalBounds, frameBounds) {
    var prototype = cjs.extend(symbol, cjs.MovieClip);
    prototype.clone = mc_symbol_clone;
    prototype.nominalBounds = nominalBounds;
    prototype.frameBounds = frameBounds;
    return prototype;
    }

(lib.blinckAnim_koin = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // koin
    this.instance = new lib.koin();
    this.instance.parent = this;

    this.instance_1 = new lib.CachedTexturedBitmap_4();
    this.instance_1.parent = this;
    this.instance_1.setTransform(3,3,0.5,0.5);

    this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(25));

}).prototype = p = new cjs.MovieClip();

(lib.blinck_lauer0 = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // lauer0
    this.instance = new lib.CachedTexturedBitmap_1();
    this.instance.parent = this;
    this.instance.setTransform(0,0,0.5,0.5);

    this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

}).prototype = getMCSymbolPrototype(lib.blinck_lauer0, null, null);

(lib.blinck = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // lauer0_obj_
    this.lauer0 = new lib.blinck_lauer0();
    this.lauer0.name = "lauer0";
    this.lauer0.parent = this;
    this.lauer0.setTransform(618.5,725.8,1,1,0,0,0,618.5,725.8);
    this.lauer0.depth = 0;
    this.lauer0.isAttachedToCamera = 0
    this.lauer0.isAttachedToMask = 0
    this.lauer0.layerDepth = 0
    this.lauer0.layerIndex = 0
    this.lauer0.maskLayerName = 0

    this.timeline.addTween(cjs.Tween.get(this.lauer0).wait(1));

}).prototype = getMCSymbolPrototype(lib.blinck, new cjs.Rectangle(0,0,1237,1451.5), null);

(lib.blinckAnim_blinck = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // blinck
    this.instance = new lib.blinck();
    this.instance.parent = this;
    this.instance.setTransform(-191.3,-43.3,1,1,0,0,0,618.4,725.8);

    this.timeline.addTween(cjs.Tween.get(this.instance).wait(1).to({regX:618.5,x:-141.3,y:6.7},0).wait(1).to({x:-91.45,y:56.65},0).wait(1).to({x:-41.6,y:106.6},0).wait(1).to({x:8.25,y:156.55},0).wait(1).to({x:58.1,y:206.5},0).wait(1).to({x:107.95,y:256.5},0).wait(1).to({x:157.8,y:306.45},0).wait(1).to({x:207.65,y:356.4},0).wait(1).to({x:257.5,y:406.35},0).wait(1).to({x:307.35,y:456.3},0).wait(1).to({x:357.2,y:506.25},0).wait(1).to({x:407.05,y:556.25},0).wait(1).to({x:456.9,y:606.2},0).wait(1).to({x:506.75,y:656.15},0).wait(1).to({x:556.6,y:706.1},0).wait(1).to({x:606.45,y:756},0).wait(1).to({x:656.25,y:805.95},0).wait(1).to({x:706.1,y:855.95},0).wait(1).to({x:755.95,y:905.9},0).wait(1).to({x:805.8,y:955.85},0).wait(1).to({x:855.65,y:1005.8},0).wait(1).to({x:905.5,y:1055.75},0).wait(1).to({x:955.4,y:1105.75},0).wait(1));

}).prototype = p = new cjs.MovieClip();

(lib.blinckAnim = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // timeline functions:
    this.frame_24 = function() {
        this.___loopingOver___ = true;
    }

    // actions tween:
    this.timeline.addTween(cjs.Tween.get(this).wait(24).call(this.frame_24).wait(1));

    // masck (mask)
    var mask = new cjs.Shape();
    mask._off = true;
    mask.graphics.p("EgrtAruQyIyHAA5nQAA5nSIyHQSHyHZmABQZngBSISHQSGSHAAZnQAAZnyGSHQyISH5nAAQ5mAByHyIg");
    mask.setTransform(400.25,400.3);

    // blinck_obj_
    this.blinck = new lib.blinckAnim_blinck();
    this.blinck.name = "blinck";
    this.blinck.parent = this;
    this.blinck.setTransform(-191.2,-43.4,1,1,0,0,0,-191.2,-43.4);
    this.blinck.depth = 0;
    this.blinck.isAttachedToCamera = 0
    this.blinck.isAttachedToMask = 0
    this.blinck.layerDepth = 0
    this.blinck.layerIndex = 0
    this.blinck.maskLayerName = 0

    var maskedShapeInstanceList = [this.blinck];

    for(var shapedInstanceItr = 0; shapedInstanceItr < maskedShapeInstanceList.length; shapedInstanceItr++) {
        maskedShapeInstanceList[shapedInstanceItr].mask = mask;
    }

    this.timeline.addTween(cjs.Tween.get(this.blinck).wait(1).to({regX:382.1,regY:531.2,x:382.1,y:531.2},0).wait(22).to({_off:true},1).wait(1));

    // koin_obj_
    this.koin = new lib.blinckAnim_koin();
    this.koin.name = "koin";
    this.koin.parent = this;
    this.koin.setTransform(400,400,1,1,0,0,0,400,400);
    this.koin.depth = 0;
    this.koin.isAttachedToCamera = 0
    this.koin.isAttachedToMask = 0
    this.koin.layerDepth = 0
    this.koin.layerIndex = 1
    this.koin.maskLayerName = 0

    this.timeline.addTween(cjs.Tween.get(this.koin).wait(25));

}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(0,0,800,800);

(lib.button = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // mainLauer
    this.instance = new lib.koin();
    this.instance.parent = this;
    this.instance.setTransform(-3,-3);

    this.instance_1 = new lib.CachedTexturedBitmap_4();
    this.instance_1.parent = this;
    this.instance_1.setTransform(0,0,0.5,0.5);

    this.instance_2 = new lib.blinckAnim();
    this.instance_2.parent = this;
    this.instance_2.setTransform(397,397,1,1,0,0,0,400,400);

    this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance,p:{scaleX:1,scaleY:1,x:-3,y:-3}}]}).to({state:[{t:this.instance_2}]},1).to({state:[{t:this.instance,p:{scaleX:0.8964,scaleY:0.8925,x:38,y:40}}]},1).to({state:[{t:this.instance_1}]},1).wait(1));

    // cirkls
    this.instance_3 = new lib.CachedTexturedBitmap_7();
    this.instance_3.parent = this;
    this.instance_3.setTransform(-2.5,-2.5,0.5,0.5);

    this.timeline.addTween(cjs.Tween.get(this.instance_3).wait(2).to({_off:true},1).wait(1));

    // masck (mask)
    var mask = new cjs.Shape();
    mask._off = true;
    var mask_graphics_2 = new cjs.Graphics().p("EgrtAruQyIyGAA5oQAA5mSIyHQSHyIZmAAQZnAASISIQSGSHAAZmQAAZoyGSGQyISH5nAAQ5mAAyHyHg");

    this.timeline.addTween(cjs.Tween.get(mask).to({graphics:null,x:0,y:0}).wait(2).to({graphics:mask_graphics_2,x:395.75,y:395.75}).wait(1).to({graphics:null,x:0,y:0}).wait(1));

    // greenBack
    this.instance_4 = new lib.butonfon();
    this.instance_4.parent = this;
    this.instance_4.setTransform(0,-10,4.1501,2.8536);
    this.instance_4._off = true;

    var maskedShapeInstanceList = [this.instance_4];

    for(var shapedInstanceItr = 0; shapedInstanceItr < maskedShapeInstanceList.length; shapedInstanceItr++) {
        maskedShapeInstanceList[shapedInstanceItr].mask = mask;
    }

    this.timeline.addTween(cjs.Tween.get(this.instance_4).wait(2).to({_off:false},0).to({_off:true},1).wait(1));

}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-812.7,-772.1,1609.7,1569.1);

(lib.Scene_1_button = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    // button
    this.instance = new lib.button();
    this.instance.parent = this;
    this.instance.setTransform(400.3,400.35,1,1,0,0,0,395.8,395.8);
    new cjs.ButtonHelper(this.instance, 0, 1, 2, false, new lib.button(), 3);

    this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));

}).prototype = getMCSymbolPrototype(lib.Scene_1_button, null, null);

// stage content:
(lib._3 = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    this.___GetDepth___ = function(obj) {
        var depth = obj.depth;
        var cameraObj = this.___camera___instance;
        if(cameraObj && cameraObj.depth && obj.isAttachedToCamera)
        {
            depth += depth + cameraObj.depth;
        }
        return depth;
        }
    this.___needSorting___ = function() {
        for (var i = 0; i < this.getNumChildren() - 1; i++)
        {
            var prevDepth = this.___GetDepth___(this.getChildAt(i));
            var nextDepth = this.___GetDepth___(this.getChildAt(i + 1));
            if (prevDepth < nextDepth)
                return true;
        }
        return false;
    }
    this.___sortFunction___ = function(obj1, obj2) {
        return (this.exportRoot.___GetDepth___(obj2) - this.exportRoot.___GetDepth___(obj1));
    }
    this.on('tick', function (event){
        var curTimeline = event.currentTarget;
        if (curTimeline.___needSorting___()){
            this.sortChildren(curTimeline.___sortFunction___);
        }
    });

    // button_obj_
    this.button = new lib.Scene_1_button();
    this.button.name = "button";
    this.button.parent = this;
    this.button.setTransform(15.3,17,1,1,0,0,0,15.3,17);
    this.button.depth = 0;
    this.button.isAttachedToCamera = 0
    this.button.isAttachedToMask = 0
    this.button.layerDepth = 0
    this.button.layerIndex = 0
    this.button.maskLayerName = 0

    this.timeline.addTween(cjs.Tween.get(this.button).wait(1));

}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(401.5,401.6,400,400);
// library properties:
lib.properties = {
    id: '65C65D0DCD45AC4B84C44760FFE9AFB2',
    width: 800,
    height: 800,
    fps: 24,
    color: "#FFFFFF",
    opacity: 1.00,
    manifest: [
        {src:"images/CachedTexturedBitmap_1.png", id:"CachedTexturedBitmap_1"},
        {src:"images/3_atlas_.png", id:"3_atlas_"},
        {src:"images/3_atlas_2.png", id:"3_atlas_2"},
        {src:"images/3_atlas_3.png", id:"3_atlas_3"}
    ],
    preloads: []
};


// bootstrap callback support:

(lib.Stage = function(canvas) {
    createjs.Stage.call(this, canvas);
}).prototype = p = new createjs.Stage();

p.setAutoPlay = function(autoPlay) {
    this.tickEnabled = autoPlay;
}
p.play = function() { this.tickEnabled = true; this.getChildAt(0).gotoAndPlay(this.getTimelinePosition()) }
p.stop = function(ms) { if(ms) this.seek(ms); this.tickEnabled = false; }
p.seek = function(ms) { this.tickEnabled = true; this.getChildAt(0).gotoAndStop(lib.properties.fps * ms / 1000); }
p.getDuration = function() { return this.getChildAt(0).totalFrames / lib.properties.fps * 1000; }

p.getTimelinePosition = function() { return this.getChildAt(0).currentFrame / lib.properties.fps * 1000; }

an.bootcompsLoaded = an.bootcompsLoaded || [];
if(!an.bootstrapListeners) {
    an.bootstrapListeners=[];
}

an.bootstrapCallback=function(fnCallback) {
    an.bootstrapListeners.push(fnCallback);
    if(an.bootcompsLoaded.length > 0) {
        for(var i=0; i<an.bootcompsLoaded.length; ++i) {
            fnCallback(an.bootcompsLoaded[i]);
        }
    }
};

an.compositions = an.compositions || {};
an.compositions['65C65D0DCD45AC4B84C44760FFE9AFB2'] = {
    getStage: function() { return exportRoot.getStage(); },
    getLibrary: function() { return lib; },
    getSpriteSheet: function() { return ss; },
    getImages: function() { return img; }
};

an.compositionLoaded = function(id) {
    an.bootcompsLoaded.push(id);
    for(var j=0; j<an.bootstrapListeners.length; j++) {
        an.bootstrapListeners[j](id);
    }
}

an.getComposition = function(id) {
    return an.compositions[id];
}

// Layer depth API : 

AdobeAn.Layer = new function() {
    this.getLayerZDepth = function(timeline, layerName)
    {
        if(layerName === "Camera")
        layerName = "___camera___instance";
        var script = "if(timeline." + layerName + ") timeline." + layerName + ".depth; else 0;";
        return eval(script);
    }
    this.setLayerZDepth = function(timeline, layerName, zDepth)
    {
        const MAX_zDepth = 10000;
        const MIN_zDepth = -5000;
        if(zDepth > MAX_zDepth)
            zDepth = MAX_zDepth;
        else if(zDepth < MIN_zDepth)
            zDepth = MIN_zDepth;
        if(layerName === "Camera")
        layerName = "___camera___instance";
        var script = "if(timeline." + layerName + ") timeline." + layerName + ".depth = " + zDepth + ";";
        eval(script);
    }
    this.removeLayer = function(timeline, layerName)
    {
        if(layerName === "Camera")
        layerName = "___camera___instance";
        var script = "if(timeline." + layerName + ") timeline.removeChild(timeline." + layerName + ");";
        eval(script);
    }
    this.addNewLayer = function(timeline, layerName, zDepth)
    {
        if(layerName === "Camera")
        layerName = "___camera___instance";
        zDepth = typeof zDepth !== 'undefined' ? zDepth : 0;
        var layer = new createjs.MovieClip();
        layer.name = layerName;
        layer.depth = zDepth;
        layer.layerIndex = 0;
        timeline.addChild(layer);
    }
}

})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
var createjs, AdobeAn;


PM MAIL   Вверх
ksnk
Дата 2.4.2019, 13:50 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


прохожий
****


Профиль
Группа: Комодератор
Сообщений: 6855
Регистрация: 13.4.2007
Где: СПб

Репутация: 84
Всего: 386



Никак. Или переписывая кучу js кода.  smile Версия adobe cc новая ? Что-то код там довольно старый. 

Если переписывать. то для начала - нужно отвязать код от идентификаторов animation_container, cаnvas и dom_overlay_container, которые тупо и цинично вписаны в код функции init. При любом  клонировании эти идентификаторы не дадут жить

Это сообщение отредактировал(а) ksnk - 2.4.2019, 13:51


--------------------
Человеку свойственно ошибаться, программисту свойственно ошибаться профессионально ! user posted image
PM MAIL WWW Skype   Вверх
xber9
Дата 2.4.2019, 18:10 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Бывалый
*


Профиль
Группа: Участник
Сообщений: 245
Регистрация: 21.1.2007

Репутация: нет
Всего: нет



Цитата(ksnk @  2.4.2019,  13:50 Найти цитируемый пост)
Версия adobe cc новая ? Что-то код там довольно старый. 

версия сс 19  какой то там билдд 
эх придется наверно все меню для сайта в animate cc делать полностью чтоб горы  кода не прелапачивать тк таких кнопок и других анимация там много
PM MAIL   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
Форум для вопросов, которые имеются в справочниках, но их поиск вызвал затруднения, или для разработчика требуется совет или просьба отыскать ошибку. Напоминаем: 1) чётко формулируйте вопрос, 2) приведите пример того, что уже сделано, 3) укажите явно, нужен работающий пример или подсказка о том, где найти информацию.
 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: Общие вопросы | Следующая тема »


 




[ Время генерации скрипта: 0.1538 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.