Repository: RamonGebben/Cquence
Branch: master
Commit: 365a01895449
Files: 8
Total size: 16.5 KB
Directory structure:
gitextract_6vgfpzsm/
├── .gitignore
├── .travis.yml
├── Cquence.js
├── Gulpfile.js
├── README.md
├── example.html
├── minified/
│ └── Cquence.js
└── package.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Ignore modules
/node_modules
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- 0.10
- 0.11
before_install:
- npm install -g gulp
script:
- gulp ci
================================================
FILE: Cquence.js
================================================
var Cq;
Cq = function(){
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function( f ){ setTimeout( f, 1000/60 ); };
var elem = function( id ){ return document.getElementById( id ); };
// IE checking
var IEVERSION = getInternetExplorerVersion();
var IE8 = IEVERSION === 8;
var IEWTF = IEVERSION < 8 && IEVERSION > -1;
var style = function( e, k, v ){
if( k === 'opacity' ){
if( IE8 ){ // gemene browsers
e.style[ "-ms-filter" ] = "progid:DXImageTransform.Microsoft.Alpha(Opacity=" + Math.floor( v * 100 ) + ")";
e.style.filter = "alpha(opacity=" + Math.floor( v * 100 ) + ")";
} else { // lieve browsers
e.style[k] = v;
}
} else {
e.style[k] = v + "px";
}
};
var combine = function(){
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments
var list = Array.prototype.slice.call( arguments, 0 );
var d = 0;
for( var i=0; i<list.length; i++ ){
d = Math.max( list[i].d, d );
}
return {
d: d,
f: function( t ){
for( var i=0; i<list.length; i++ ){
var last = list[i];
if( last.d > t ){
last.f( t );
} else {
if( !last.done ){
last.f( last.d );
last.done = true;
}
}
}
}
};
};
var sequence = function(){
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions_and_function_scope/arguments
var timeline = Array.prototype.slice.call( arguments, 0 );
var d = 0;
for( var i=0; i<timeline.length; i++ ){
d = d + timeline[i].d;
}
return {
d: d,
f: function( t ){
var last = null;
var total = 0;
for( var i=0; i<timeline.length; i++ ){
last = timeline[i];
if( total + last.d > t ){
last.f( t - total );
return;
}
if( !last.done ){
last.f( last.d );
last.done = true;
}
total = total + last.d;
}
}
};
};
var animate = function( transform ){
return function( id, dur, begin, fin ){
return {
d: dur,
f: function( t ){
var e = elem( id );
for( var k in begin ){
var bv = begin[k]; // begin waarde
var fv = fin[k]; // finish waarde
var dx = fv - bv; // verschil (afstand)
// p is nu een waarde tussen de 0 en 1 .. en geeft aan hoe ver de animatie is
var p = transform( Math.max( t/dur, 0 ) );
// nieuwe waarde is de factor maal de afstand
var nv = bv + (p * dx);
style( e, k, nv );
}
}
};
};
};
// animation variants
// http://upshots.org/actionscript/jsas-understanding-easing
var linear = animate( function( p ){
return p;
});
var easeIn = animate( function( p ){
return Math.pow( p, 5 );
});
var easeOut = animate( function( p ){
return 1 - Math.pow( 1 - p, 5 );
});
var sleep = function( d ){
return { d: d, f: function(t){} };
};
/* from: http://stackoverflow.com/questions/10964966/detect-ie-version-in-javascript */
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) !== null)
rv = parseFloat( RegExp.$1 );
}
return rv;
}
var timeline = [];
var start = (+new Date()); // unix timestamp
var second = 1000;
var stop = 15 * second;
var render = null;
// gets called recursive by request-animation-frame
var renderloop = function(){
// console.log('1. ', window.render );
var now = (+new Date()) - start; // relatieve tijd vanaf begin animatie
if( now < stop ) raf( renderloop ); // recursion, baby
// console.log('2. ', window.render );
if( window.render ) window.render.f( now );
};
return {
combine: combine,
sequence: sequence,
linear: linear,
animate: animate,
easeIn: easeIn,
easeOut: easeOut,
sleep: sleep,
renderloop: renderloop
};
}();
================================================
FILE: Gulpfile.js
================================================
var gulp = require("gulp"),
uglify = require("gulp-uglify"),
jshint = require('gulp-jshint'),
stylish = require('jshint-stylish');
gulp.task('lint', function() {
return gulp.src('./Cquence.js')
.pipe(jshint())
.pipe(jshint.reporter( stylish ));
});
gulp.task("compress", function(){
gulp.src("./Cquence.js").pipe( uglify() ).pipe( gulp.dest("minified") );
});
gulp.task('ci', ['lint', 'compress']);
================================================
FILE: README.md
================================================
# Cquence.js
[](https://travis-ci.org/RamonGebben/Cquence)
Cquence is a very small Javascript animation library developed for banners and advertisement.
[Demo](http://ramongebben.github.io/Cquence)
## Basic usage
```javascript
render = null; // Define the render object so that the renderloop knows what to render.
render = Cquence.combine() // Combine fires the sequences in its body the same time
render = Cquence.sequence() // Define the animations in order to create a timeline
Cq.sequence(
Cq.easIn( :id, :time, { :from }, { :to }),
Cq.easOut( :id, :time, { :from }, { :to }),
Cq.sleep( :time ) // Wait utill time is passed
)
```
## Full example
```javascript
render = Cq.combine(
Cq.sequence(
Cq.sleep( 100 ),
Cq.linear('frame3', 10000, { left: -900 }, {left: 300 })
),
Cq.sequence(
Cq.easeOut('frame1', 2000, { left: -1000 }, { left: 120 }),
Cq.easeIn('frame6', 1000, { opacity: 0 }, { opacity: 1}),
Cq.easeIn('frame7', 1000, { opacity: 0 }, { opacity: 1}),
Cq.combine(
Cq.easeIn('frame6', 1500, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame7', 1500, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame8', 1500, { opacity: 0 }, { opacity: 1})
),
Cq.sleep(1000),
Cq.easeIn('frame8', 1000, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame9', 1000, { opacity: 0, left: -300 }, { opacity: 1, left: 10}),
Cq.sleep(1500),
Cq.sequence(
Cq.combine(
Cq.easeIn('frame1', 1500, { left: 120 }, { left: -620 }),
Cq.easeOut('frame9', 2000, { opacity: 1, left: 10 }, { opacity: 0, left: -300 })
),
Cq.easeIn('frame2', 1000, { opacity: 0 },{ opacity: 0 }),
Cq.easeOut('frame10', 1000, { bottom: -260 }, { bottom: 0 })
)
)
);
// launch the animation
Cq.renderloop();
```
Then your HMTL should look something like this:
```html
<div id='container'>
<div id='frame1' class ="frame">
<img src="http://example.com/some_sprite.png">
</div>
<div id='frame2' class ="frame">
<img src="http://example.com/some_sprite.png" style="left: -300px; top: 40px;">
</div>
<div id='frame3' class ="frame">
<img src="http://example.com/some_sprite.png" style="left: -602px">
</div>
<div id='frame4' class ="frame">
<img src="http://example.com/some_sprite.png" style="left: -600px;">
</div>
<div id='frame5' class ="frame">
<img src="http://example.com/some_sprite.png" style="left: -1350px;">
</div>
<div id='frame6' class ="frame">
<p>Hey there,</p>
</div>
<div id='frame7' class ="frame">
<p>People call me</p>
</div>
<div id='frame8' class ="frame">
<p>RamonGebben</p>
</div>
<div id='frame9' class ="frame">
<p>And this is an awesome lib </p>
</div>
<div id='frame10' class ="frame">
<div id="cta">
<div id="button">Download</div>
</div>
</div>
</div>
```
## Development
We use Gulp for build tasks.
To minify/uglify for production use:
```bash
gulp compress
```
### Linting
We use jshint for linting.
Run the gulp task to check.
```bash
gulp lint
```
## Licence
Copyright (c) 2015 RamonGebben
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: example.html
================================================
<!DOCTYPE html>
<title>Cquence example</title>
<style>
body { padding: 0; margin: 0; font-family: "Lucida Console", Monaco, monospace; }
div { position: absolute; overflow: hidden; }
#container { border: 1px solid black; width: 298px; height: 248px; background-color: black;}
.frame { width: 300px; height: 250px; }
img { position: relative }
#frame1 { z-index: 500; left: -1000px; } /* Monk */
#frame2 { z-index: 700; left: 0px; top: -40px; opacity: 0; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); filter: alpha(opacity=0); } /* Media Monks*/
#frame3 { z-index: 300; width: 750px; left: -1000px; } /* Smoke */
#frame4 { z-index: 400; left: -1000px; } /* */
#frame5 { z-index: 600; left: 0px; } /* shader */
#frame6 { z-index: 600; left: 20px; top: 120px; opacity: 0; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); filter: alpha(opacity=0);}
#frame6 p { color: white; font-size: 20px; }
/* peeps call me */
#frame7 { z-index: 600; top: 150px; left: 20px; opacity: 0; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); filter: alpha(opacity=0);}
#frame7 p { color: white; font-size: 25px; }
/* Ramon */
#frame8 { z-index: 600; top: 130px; left: 20px; opacity: 0; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); filter: alpha(opacity=0);}
#frame8 p { color: white; font-size: 35px; }
/* rocking it */
#frame9 { z-index: 600; top: 160px; left: -300px; opacity: 0; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); filter: alpha(opacity=0);}
#frame9 p { color: white; font-size: 17px; }
#frame9 p strong { color: white; font-size: 20px; }
/* Call to action */
#frame10 { z-index: 750; bottom: -260px; left: 0px; opacity: 1; background-image: url('http://i.imgur.com/OCHWcon.png'); background-repeat: no-repeat; background-size: 100%; background-position: center; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); filter: alpha(opacity=100);}
#frame10 #cta { color: #ddd; font-weight: 900; font-size: 20px; width: 100%; background-color: #333; display: inline-block; height: 40px; transition: background-color 0.4s ease;}
#frame10 #cta:hover { background-color: #fff; transition: background-color 0.4s ease; }
#frame10 #cta #button { width: 100%; height: 26px; top: 6px; left: 5px; border-radius: 4px; z-index: 751; cursor: pointer; text-align: center
; }
#frame10 #cta p { position: absolute; left: 60px; top: -11px; z-index: 750; }
</style>
<div id='container'>
<div id='frame1' class ="frame">
<img src="http://ra-ge.net/assets/assets_mediamonks.png">
</div>
<div id='frame2' class ="frame">
<img src="http://ra-ge.net/assets/assets_mediamonks.png" style="left: -300px; top: 40px;">
</div>
<div id='frame3' class ="frame">
<img src="http://ra-ge.net/assets/assets_mediamonks.png" style="left: -602px">
</div>
<div id='frame4' class ="frame">
<img src="http://ra-ge.net/assets/assets_mediamonks.png" style="left: -600px;">
</div>
<div id='frame5' class ="frame">
<img src="http://ra-ge.net/assets/assets_mediamonks.png" style="left: -1350px;">
</div>
<div id='frame6' class ="frame">
<p>Hey there,</p>
</div>
<div id='frame7' class ="frame">
<p>People call me</p>
</div>
<div id='frame8' class ="frame">
<p>Ramon Gebben</p>
</div>
<div id='frame9' class ="frame">
<p>And this is an awesome lib </p>
</div>
<div id='frame10' class ="frame">
<div id="cta">
<div id="button">Download</div>
</div>
</div>
</div>
<br>
<script src="Cquence.js"></script>
<script>
render = Cq.combine(
Cq.sequence(
Cq.sleep( 100 ),
Cq.linear('frame3', 10000, { left: -900 }, {left: 300 })
),
Cq.sequence(
Cq.easeOut('frame1', 2000, { left: -1000 }, { left: 120 }),
Cq.easeIn('frame6', 1000, { opacity: 0 }, { opacity: 1}),
Cq.easeIn('frame7', 1000, { opacity: 0 }, { opacity: 1}),
Cq.combine(
Cq.easeIn('frame6', 1500, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame7', 1500, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame8', 1500, { opacity: 0 }, { opacity: 1})
),
Cq.sleep(1000),
Cq.easeIn('frame8', 1000, { opacity: 1 }, { opacity: 0}),
Cq.easeIn('frame9', 1000, { opacity: 0, left: -300 }, { opacity: 1, left: 10}),
Cq.sleep(1500),
Cq.sequence(
Cq.combine(
Cq.easeIn('frame1', 1500, { left: 120 }, { left: -620 }),
Cq.easeOut('frame9', 2000, { opacity: 1, left: 10 }, { opacity: 0, left: -300 })
),
Cq.easeIn('frame2', 1000, { opacity: 0 },{ opacity: 0
}),
Cq.easeOut('frame10', 1000, { bottom: -260 }, { bottom: 0 })
)
),
Cq.sequence(
)
);
// launch the animation
Cq.renderloop();
</script>
================================================
FILE: minified/Cquence.js
================================================
var Cq;Cq=function(){function n(){var n=-1;if("Microsoft Internet Explorer"==navigator.appName){var e=navigator.userAgent,t=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!==t.exec(e)&&(n=parseFloat(RegExp.$1))}return n}var e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(n){setTimeout(n,1e3/60)},t=function(n){return document.getElementById(n)},r=n(),o=8===r,a=function(n,e,t){"opacity"===e?o?(n.style["-ms-filter"]="progid:DXImageTransform.Microsoft.Alpha(Opacity="+Math.floor(100*t)+")",n.style.filter="alpha(opacity="+Math.floor(100*t)+")"):n.style[e]=t:n.style[e]=t+"px"},i=function(){for(var n=Array.prototype.slice.call(arguments,0),e=0,t=0;t<n.length;t++)e=Math.max(n[t].d,e);return{d:e,f:function(e){for(var t=0;t<n.length;t++){var r=n[t];r.d>e?r.f(e):r.done||(r.f(r.d),r.done=!0)}}}},u=function(){for(var n=Array.prototype.slice.call(arguments,0),e=0,t=0;t<n.length;t++)e+=n[t].d;return{d:e,f:function(e){for(var t=null,r=0,o=0;o<n.length;o++){if(t=n[o],r+t.d>e)return void t.f(e-r);t.done||(t.f(t.d),t.done=!0),r+=t.d}}}},f=function(n){return function(e,r,o,i){return{d:r,f:function(u){var f=t(e);for(var c in o){var l=o[c],d=i[c],s=d-l,m=n(Math.max(u/r,0)),p=l+m*s;a(f,c,p)}}}}},c=f(function(n){return n}),l=f(function(n){return Math.pow(n,5)}),d=f(function(n){return 1-Math.pow(1-n,5)}),s=function(n){return{d:n,f:function(){}}},m=+new Date,p=1e3,w=15*p,v=function(){var n=+new Date-m;w>n&&e(v),window.render&&window.render.f(n)};return{combine:i,sequence:u,linear:c,animate:f,easeIn:l,easeOut:d,sleep:s,renderloop:v}}();
================================================
FILE: package.json
================================================
{
"name": "Cquence",
"description": "A very tiny Javascript animation library",
"author": "Ramon Gebben <cquence@ra-ge.net>",
"version": "1.0.0",
"devDependencies": {
"gulp": "^3.8.10",
"gulp-jshint": "^1.9.0",
"gulp-uglify": "^1.0.2",
"jshint-stylish": "^1.0.0"
}
}
gitextract_6vgfpzsm/ ├── .gitignore ├── .travis.yml ├── Cquence.js ├── Gulpfile.js ├── README.md ├── example.html ├── minified/ │ └── Cquence.js └── package.json
SYMBOL INDEX (2 symbols across 2 files)
FILE: Cquence.js
function getInternetExplorerVersion (line 123) | function getInternetExplorerVersion()
FILE: minified/Cquence.js
function n (line 1) | function n(){var n=-1;if("Microsoft Internet Explorer"==navigator.appNam...
Condensed preview — 8 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (18K chars).
[
{
"path": ".gitignore",
"chars": 30,
"preview": "# Ignore modules\n/node_modules"
},
{
"path": ".travis.yml",
"chars": 107,
"preview": "language: node_js\n\nnode_js:\n - 0.10\n - 0.11\n\nbefore_install:\n - npm install -g gulp\n\nscript:\n - gulp ci"
},
{
"path": "Cquence.js",
"chars": 5272,
"preview": "\nvar Cq;\n\nCq = function(){\n var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webki"
},
{
"path": "Gulpfile.js",
"chars": 414,
"preview": "var gulp = require(\"gulp\"),\nuglify = require(\"gulp-uglify\"),\njshint = require('gulp-jshint'),\nstylish = require('jshint-"
},
{
"path": "README.md",
"chars": 4310,
"preview": "\n\n# Cquence.js\n\n[](https://travis-ci.org/Ram"
},
{
"path": "example.html",
"chars": 4842,
"preview": "<!DOCTYPE html>\n<title>Cquence example</title>\n<style>\n\n body { padding: 0; margin: 0; font-family: \"Lucida Console\", M"
},
{
"path": "minified/Cquence.js",
"chars": 1626,
"preview": "var Cq;Cq=function(){function n(){var n=-1;if(\"Microsoft Internet Explorer\"==navigator.appName){var e=navigator.userAgen"
},
{
"path": "package.json",
"chars": 295,
"preview": "{\n \"name\": \"Cquence\",\n \"description\": \"A very tiny Javascript animation library\",\n \"author\": \"Ramon Gebben <cquence@r"
}
]
About this extraction
This page contains the full source code of the RamonGebben/Cquence GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 8 files (16.5 KB), approximately 5.2k tokens, and a symbol index with 2 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.