Skip to content
Snippets Groups Projects
Commit 89c79654 authored by Katarína Sieklová's avatar Katarína Sieklová
Browse files

fix: THE FRICKING ANIMATION WOOOOORKS BITCHEEEES

parent dd1ec287
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -2,15 +2,18 @@ ...@@ -2,15 +2,18 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="./src/assets/girly/girly-happy.svg" /> <link rel="icon" type="image/svg+xml" href="./src/assets/girly/girl-happy.svg" />
<link href="/dist/output.css" rel="stylesheet"> <link href="/dist/output.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Insu-Learn</title> <title>Insu-Learn</title>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script src="src/animations/intro.js" type="text/javascript"></script>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<script src="https://code.createjs.com/1.0.0/createjs.min.js" type="text/javascript"></script>
<script src="/intro.js" type="text/javascript"></script>
<script type="module" src="/src/main.tsx"></script> <script type="module" src="/src/main.tsx"></script>
</body> </body>
</html> </html>
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
"react-adobe-animate": "^3.1.0", "react-adobe-animate": "^3.1.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.14.0", "react-router-dom": "^6.14.0",
"react-scripts": "^5.0.1",
"typewriter-effect": "^2.20.1" "typewriter-effect": "^2.20.1"
}, },
"devDependencies": { "devDependencies": {
......
src/animations/images/intro_atlas_1.png

54 KiB

<!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>intro</title>
<!-- write your code here -->
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script src="intro.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("93F29AEBD1DB8F42BC5A007E858F897B");
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.intro12();
stage = new lib.Stage(canvas);
stage.enableMouseOver();
//Registers the "tick" event listener.
fnStartAnimation = function() {
stage.addChild(exportRoot);
createjs.Ticker.framerate = lib.properties.fps;
createjs.Ticker.addEventListener("tick", stage);
}
//Code to support hidpi screens and responsive scaling.
AdobeAn.makeResponsive(true,'both',true,2,[canvas,anim_container,dom_overlay_container]);
AdobeAn.compositionLoaded(lib.properties.id);
fnStartAnimation();
}
</script>
<!-- write your code here -->
</head>
<body onload="init();" style="margin:0px;">
<div id="animation_container" style="background-color:rgba(255, 255, 255, 1.00);">
<canvas id="canvas" style="position: absolute; display: block; background-color:rgba(255, 255, 255, 1.00);"></canvas>
<div id="dom_overlay_container" style="pointer-events:none; overflow:hidden; position: absolute; left: 0px; top: 0px; display: block;">
</div>
</div>
</body>
</html>
(function (cjs, an) {
var p; // shortcut to reference prototypes
var lib={};var ss={};var img={};
lib.ssMetadata = [
{name:"intro_atlas_1", frames: [[0,615,511,426],[923,500,96,109],[513,865,526,119],[0,0,921,613],[513,615,310,248],[825,615,310,248],[923,0,310,248],[923,250,310,248]]}
];
(lib.AnMovieClip = function(){
this.actionFrames = [];
this.ignorePause = false;
this.gotoAndPlay = function(positionOrLabel){
cjs.MovieClip.prototype.gotoAndPlay.call(this,positionOrLabel);
}
this.play = function(){
cjs.MovieClip.prototype.play.call(this);
}
this.gotoAndStop = function(positionOrLabel){
cjs.MovieClip.prototype.gotoAndStop.call(this,positionOrLabel);
}
this.stop = function(){
cjs.MovieClip.prototype.stop.call(this);
}
}).prototype = p = new cjs.MovieClip();
// symbols:
(lib.CachedBmp_8 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(0);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_7 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(1);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_6 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(2);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_5 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(3);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_22 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(4);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_21 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(5);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_20 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(6);
}).prototype = p = new cjs.Sprite();
(lib.CachedBmp_19 = function() {
this.initialize(ss["intro_atlas_1"]);
this.gotoAndStop(7);
}).prototype = p = new cjs.Sprite();
(lib.Tween13 = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
var props = new Object();
props.mode = mode;
props.startPosition = startPosition;
props.labels = {};
props.loop = loop;
props.reversed = reversed;
cjs.MovieClip.apply(this,[props]);
// Layer_1
this.instance = new lib.CachedBmp_8();
this.instance.setTransform(-127.85,-106.2,0.5,0.5);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));
this._renderFirstFrame();
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-127.8,-106.2,255.5,213);
(lib.Tween8 = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
var props = new Object();
props.mode = mode;
props.startPosition = startPosition;
props.labels = {};
props.loop = loop;
props.reversed = reversed;
cjs.MovieClip.apply(this,[props]);
// Layer_1
this.instance = new lib.CachedBmp_7();
this.instance.setTransform(-24.2,-27.1,0.5,0.5);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));
this._renderFirstFrame();
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-24.2,-27.1,48,54.5);
(lib.continuebutton = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
var props = new Object();
props.mode = mode;
props.startPosition = startPosition;
props.labels = {};
props.loop = loop;
props.reversed = reversed;
cjs.MovieClip.apply(this,[props]);
// Layer_1
this.instance = new lib.CachedBmp_6();
this.instance.setTransform(-139,-105.7,0.5,0.5);
this.instance_1 = new lib.CachedBmp_5();
this.instance_1.setTransform(-235.2,-227.15,0.5,0.5);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_1},{t:this.instance}]}).wait(1));
this._renderFirstFrame();
}).prototype = p = new cjs.MovieClip();
p.nominalBounds = new cjs.Rectangle(-235.2,-227.1,460.5,306.5);
// stage content:
(lib.intro12 = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
var props = new Object();
props.mode = mode;
props.startPosition = startPosition;
props.labels = {};
props.loop = loop;
props.reversed = reversed;
cjs.MovieClip.apply(this,[props]);
this.actionFrames = [23];
// timeline functions:
this.frame_23 = function() {
this.stop();
var movieClip = this;
this.addEventListener("click", function() {
movieClip.play();
});
}
// actions tween:
this.timeline.addTween(cjs.Tween.get(this).wait(23).call(this.frame_23).wait(1));
// Layer_1
this.instance = new lib.Tween13("synched",0);
this.instance.setTransform(127.85,207.1,1,1,0,0,0,0,101.2);
this.instance_1 = new lib.CachedBmp_20();
this.instance_1.setTransform(51.8,206.15,0.5,0.5);
this.instance_2 = new lib.Tween13("synched",0);
this.instance_2.setTransform(127.85,207.1,1,1,0,0,0,0,101.2);
this.instance_3 = new lib.CachedBmp_19();
this.instance_3.setTransform(51.8,206.15,0.5,0.5);
this.instance_4 = new lib.CachedBmp_22();
this.instance_4.setTransform(51.8,206.15,0.5,0.5);
this.instance_5 = new lib.CachedBmp_21();
this.instance_5.setTransform(51.8,206.15,0.5,0.5);
this.timeline.addTween(cjs.Tween.get({}).to({state:[{t:this.instance_3},{t:this.instance_2},{t:this.instance_1},{t:this.instance}]}).to({state:[{t:this.instance_5},{t:this.instance_2},{t:this.instance_4},{t:this.instance}]},23).wait(1));
// button
this.instance_6 = new lib.continuebutton();
this.instance_6.setTransform(134.5,426.65,0.3482,0.2813);
this.instance_6._off = true;
new cjs.ButtonHelper(this.instance_6, 0, 1, 1);
this.timeline.addTween(cjs.Tween.get(this.instance_6).wait(23).to({_off:false},0).wait(1));
// Tween_8
this.instance_7 = new lib.Tween8("synched",0);
this.instance_7.setTransform(169.05,214.15,1,1,0,0,0,-18.2,-17.7);
this.timeline.addTween(cjs.Tween.get(this.instance_7).to({rotation:-38.9526,x:169.7,y:217.6},6).to({scaleX:0.9999,scaleY:0.9999,rotation:-0.7528,x:169.85,y:217},6).to({regY:-17.6,rotation:-39.8804,x:171.1,y:217.05},5).to({regY:-17.7,scaleX:1,scaleY:1,rotation:0,x:169.05,y:214.15},6).wait(1));
this._renderFirstFrame();
}).prototype = p = new lib.AnMovieClip();
p.nominalBounds = new cjs.Rectangle(127.5,225.7,128,223.3);
// library properties:
lib.properties = {
id: '93F29AEBD1DB8F42BC5A007E858F897B',
width: 255,
height: 452,
fps: 24,
color: "#FFFFFF",
opacity: 1.00,
manifest: [
{src:"images/intro_atlas_1.png", id:"intro_atlas_1"}
],
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['93F29AEBD1DB8F42BC5A007E858F897B'] = {
getStage: function() { return exportRoot.stage; },
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];
}
an.makeResponsive = function(isResp, respDim, isScale, scaleType, domContainers) {
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);
}
}
domContainers[0].width = w * pRatio * sRatio;
domContainers[0].height = h * pRatio * sRatio;
domContainers.forEach(function(container) {
container.style.width = w * sRatio + 'px';
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;
}
}
an.handleSoundStreamOnTick = function(event) {
if(!event.paused){
var stageChild = stage.getChildAt(0);
if(!stageChild.paused || stageChild.ignorePause){
stageChild.syncStreamSounds();
}
}
}
an.handleFilterCache = function(event) {
if(!event.paused){
var target = event.target;
if(target){
if(target.filterCacheList){
for(var index = 0; index < target.filterCacheList.length ; index++){
var cacheInst = target.filterCacheList[index];
if((cacheInst.startFrame <= target.currentFrame) && (target.currentFrame <= cacheInst.endFrame)){
cacheInst.instance.cache(cacheInst.x, cacheInst.y, cacheInst.w, cacheInst.h);
}
}
}
}
}
}
})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
var createjs, AdobeAn;
\ No newline at end of file
...@@ -38,28 +38,32 @@ ...@@ -38,28 +38,32 @@
// export default Test; // export default Test;
import { useState } from 'react'; import { useState } from 'react';
import { AnimateCC, GetAnimationObjectParameter } from 'react-adobe-animate'; import { AnimateCC } from 'react-adobe-animate';
const Test = () => { const Test = () => {
const [paused, setPaused] = useState(true); const [paused, setPaused] = useState(false);
const [animationObject, getAnimationObject] = const [, setAnimationObject] = useState(null);
useState<GetAnimationObjectParameter | null>(null); const getAnimationObject = (obj: any) => setAnimationObject(obj);
const onClick = () => setPaused(!paused); const onClick = () => setPaused(!paused);
console.log(animationObject); // console.log(animationObject);
return ( return (
<div className="mt-12 flex justify-center"> <>
<div id="animation-container" style={{ width: '255px', height: '452px' }}> <div className="mt-12 flex justify-center">
<AnimateCC <div
animationName="intro:" id="animation-container"
getAnimationObject={getAnimationObject} style={{ width: '255px', height: '452px' }}
paused={paused} >
/> <AnimateCC
animationName="intro12"
getAnimationObject={getAnimationObject}
paused={paused}
/>
</div>
</div> </div>
<button onClick={onClick}>{paused ? 'Unpause' : 'Pause'}</button> <button onClick={onClick}>{paused ? 'Unpause' : 'Pause'}</button>
</div> </>
); );
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment