<!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>012_a</title>
<!-- write your code here -->
<style>
#animation_container, #_preload_div_ {
position:absolute;
margin:auto;
left:0;right:0;
top:0;bottom:0;
}
</style>
<script src="https://code.createjs.com/createjs-2015.11.26.min.js"></script>
<script>
function LoadGFonts(families, comp) {
var lib=comp.getLibrary();
var googleObject = {type: "Google", loadedFonts: 0, totalFonts: families.length, callOnLoad: lib.gfontAvailable};
for(var i =0; i < families.length; i++)
isFontAvailable(gFontsFamilies[i], googleObject);
}
function isFontAvailable(font, obj) {
var timeOut = 5000;
var delay = 200;
var interval = 0;
var timeElapsed = 0;
function checkFont() {
var node = document.createElement("span");
node.innerHTML = "giItT1WQy@!-/#";
node.style.position = "absolute";
node.style.left = "-1000px";
node.style.top = "-1000px";
node.style.fontSize = "300px";
node.style.fontFamily = "sans-serif";
node.style.fontVariant = "normal";
node.style.fontStyle = "normal";
node.style.fontWeight = "normal";
node.style.letterSpacing = "0";
document.body.appendChild(node);
var width = node.offsetWidth;
node.style.fontFamily = font+","+node.style.fontFamily;
var returnVal = false;
if((node && node.offsetWidth != width) || timeElapsed >=timeOut) {
obj.loadedFonts++;
if(interval)
clearInterval(interval);
obj.callOnLoad(font, obj.totalFonts);
returnVal = true;
}
if(node) {
node.parentNode.removeChild(node);
node = null;
}
timeElapsed += delay;
return returnVal;
}
if(!checkFont()) {
interval = setInterval(checkFont, delay);
}
}
</script>
<script>
var gFontsFamilies = ["Roboto"];
</script>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:regular&subset=latin">
<script src="012_a.js?1554997525621"></script>
<script>
// Global Scripts
// プレビュー時はスーパーリロードを使用(Macの場合)
//Command + Shift + R
//Chromeとサファリは画面クリックしないと音が出ない仕様らしい
//alert("112"); アラート
//ページ全体の色を変える場合、パブリッシュ後のhtmlの
//<body>タグ内に background-color:rgba(0, 0, 0, 1.00); 例:黒 書き込んで変更する事
//animatecc内からでは操作できないらしい?
var jump_fr = 0; //ブラックアウト後の移動フレーム
var iziri_count = 0; //いじりアクションカウント
//var speed_count = 0; //いじりスピードカウント
var next_count = 0; //トータルいじり回数カウント
var syokai_act = 0; //初回いじり判定
var serif_flg = [0,0]; //セリフフラグ
function black_out (num) {
jump_fr = num;
exportRoot.black_out.gotoAndPlay(2);
};
function randomizer1 (num) {
var ran_num = Math.floor( Math.random() * num );
exportRoot.test_tex.text = "randm" + ran_num;
return ran_num;
};
var vo_rondom_num = 0;
function vo_rondom (num) {//ボイスランダム
var i = Math.floor( Math.random() * num );
if(i == vo_rondom_num){
i ++;
};
if(i > (num - 1)){
i = 0;
};
vo_rondom_num = i;
//exportRoot.test_tex.text = i;
return i;
};
var se_rondom_num = 0;
function se_rondom (num) {//seランダム
var i = Math.floor( Math.random() * num );
if(i == se_rondom_num){
i ++;
};
if(i > (num - 1)){
i = 0;
};
se_rondom_num = i;
//exportRoot.test_tex.text = i;
return i;
};
function start_func (evt) {//初回クリックスタート
exportRoot.start_mc.gotoAndPlay("act1");
createjs.Sound.play("claick_se");
evt.currentTarget.removeEventListener('mousedown', start_func, false);//自分消去
//evt.remove(); ※自己消去機能せず
//evt.currentTarget.removeEventListener('mousedown', arguments.callee, false);//自分消去
//※arguments.calleeでも可能だが非推奨らしい
};
function act_func (evt) {//メイン操作
iziri_counter(1);
if((exportRoot.main_mc.currentFrame >= 88) && (exportRoot.main_mc.currentFrame <= 147)){
exportRoot.main_mc.gotoAndPlay("brs2_ed") ;
};
};
function iziri_counter (num) {//いじり回数カウンタ
if((iziri_count + num <= 3)&&(iziri_count + num >= 0 )){
iziri_count += num;
};
//exportRoot.test_tex.text = iziri_count;
};
function next_counter (num) {//next回数カウンタ
if((next_count + num <= 60)&&(next_count + num >= 0 )){
next_count += num;
};
exportRoot.test_tex2.text = next_count;
//ハート反映
heart_counter (num);
};
//ハート増減
function heart_counter (num) {//next回数カウンタ
if(num < 0){//マイナス(減る場合
if((next_count + num < 50) && (exportRoot.meter_mc.heart_mc3.currentFrame == 14)){
exportRoot.meter_mc.heart_mc3.gotoAndPlay("act2");
}else if((next_count + num < 30) && (exportRoot.meter_mc.heart_mc2.currentFrame == 14)){
exportRoot.meter_mc.heart_mc2.gotoAndPlay("act2");
}else if((next_count + num < 10) && (exportRoot.meter_mc.heart_mc1.currentFrame == 14)){
exportRoot.meter_mc.heart_mc1.gotoAndPlay("act2");
};
}else{//プラス 増える場合
if((next_count + num >= 55) && (exportRoot.meter_mc.heart_mc3.currentFrame == 0)){
exportRoot.meter_mc.heart_mc3.gotoAndPlay("act1");
}else if((next_count + num >= 35) && (exportRoot.meter_mc.heart_mc2.currentFrame == 0)){
exportRoot.meter_mc.heart_mc2.gotoAndPlay("act1");
}else if((next_count + num >= 15) && (exportRoot.meter_mc.heart_mc1.currentFrame == 0)){
exportRoot.meter_mc.heart_mc1.gotoAndPlay("act1");
};
};
};
//function replay_func (evt) {//リプレイボタン
// iziri_count = 0; //いじりアクションカウント
// next_count = 0; //トータルいじり回数カウント
// syokai_act = 0; //初回いじり判定
// exportRoot.main_mc.gotoAndPlay("end");
// black_out (0);
// evt.currentTarget.removeEventListener('mousedown', replay_func, false);//自分消去
//
//};</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("E97E3F900F5A45D99B05755D6A83A742");
var lib=comp.getLibrary();
try {
if(!(typeof gFontsFamilies === 'undefined' || gFontsFamilies === null))
LoadGFonts(gFontsFamilies, comp);
if(!(typeof totalTypekitFonts === 'undefined' || totalTypekitFonts === null)) {
var typekitObject = {type: 'Typekit', loadedFonts: 0, totalFonts: totalTypekitFonts, callOnLoad: lib.tfontAvailable};
Typekit.load({
async: true,
'fontactive': function(family) {
isFontAvailable(family, typekitObject);
}
});
}
} catch(e) {};
var loader = new createjs.LoadQueue(false);
loader.installPlugin(createjs.Sound);
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} )
}
var preloaderDiv = document.getElementById("_preload_div_");
preloaderDiv.style.display = 'none';
canvas.style.display = 'block';
exportRoot = new lib._012_a();
stage = new lib.Stage(canvas);
//Registers the "tick" event listener.
fnStartAnimation = function() {
stage.addChild(exportRoot);
createjs.Ticker.setFPS(lib.properties.fps);
createjs.Ticker.addEventListener("tick", stage);
}
//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 = anim_container.style.width = dom_overlay_container.style.width = preloaderDiv.style.width = w*sRatio+'px';
canvas.style.height = anim_container.style.height = dom_overlay_container.style.height = preloaderDiv.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,'height',true,1);
AdobeAn.compositionLoaded(lib.properties.id);
fnStartAnimation();
}
function playSound(id, loop) {
return createjs.Sound.play(id, createjs.Sound.INTERRUPT_EARLY, 0, 0, loop);
}
</script>
<!-- write your code here -->
</head>
<body onload="init();" style="margin:0px; background-color:rgba(0, 0, 0, 1.00);">
<div id="animation_container" style="background-color:rgba(0, 0, 0, 1.00); width:640px; height:1136px">
<canvas id="canvas" width="640" height="1136" style="position: absolute; display: none; background-color:rgba(0, 0, 0, 1.00);"></canvas>
<div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; width:640px; height:1136px; position: absolute; left: 0px; top: 0px; display: none;">
</div>
</div>
<div id='_preload_div_' style='position:absolute; top:0; left:0; display: inline-block; height:1136px; width: 640px; text-align: center;'> <span style='display: inline-block; height: 100%; vertical-align: middle;'></span> <img src=images/_preloader.gif?1554997525622 style='vertical-align: middle; max-height: 100%'/></div>
</body>
</html>解析代码
最新发布