Frame Animation Manager

Overview

Clockz.js (demo)

SlugBay Badge

Screenshot

Clockz is a Super-smooth Frame Animation manager to help you manage multiples animations in same time. Installation

Just include this script after jQuery. Requires jQuery 1.4+.

<script src='js/jquery.js'></script>
<script src='js/clockz.js'></script>

Animation

This is how you can define a complex animation.

var myAnim = {
	name: 'phone2',				// Animation name
	loop: true,					// looping ? (default: false)
	loopStart: 0,				// loop start frame index (default: 0)
	loopEnd: 3,					// loop end frame index
	frames: [
		{
			duration: 2000		// Frame duration, used without properties to pause
		},
		{
			type: 'jquery',		// Frame type, used for hook (default: jquery)
			properties: {		// Frame properties
				left: 410
			},
			duration: 800,		// Frame properties
			easing: 'swing'		// Frame easing
		}
	]					
};

Hook

With a hook function, you can manage multiples animation frameworks like jQuery, Transit, Greensock and much mores.

clockz.playHook = function(node, frame, callback) {
	var duration = frame.duration || 400;
	var properties = frame.properties || null;			
	if (properties) {
		var jnode = $(node); // node selector (ex: '.class','#id' etc..)
		if (!jnode) {
			this.error( 'playHook(): node is invalid.' );
			return;					
		}
		var type = frame.type || 'jquery';
		var easing = frame.easing || 'swing';				
		switch (type) {
			// handle jQuery frames
			case 'jquery':
	                	$(node).animate(properties, duration, easing, callback);
	                	break;
			// handle Transit frames
			case 'transit':
				$(node).transition($.extend({
					duration: duration,
					easing: easing,
					complete: callback
				}, properties));
				break;
			// handle Greensock frames
			case 'greensock':
				// ...
				break;
		}
	}
	else {
		setTimeout(callback, duration); // to pause animation when no frame properties found
	}               
};

Usage

This is a complete example to see Clockz in action ;-)

$(function () {

	// create a new clockz manager
	var clockz = new Clockz();

	console.log( 'jquery: ' + $().jquery );
	console.log( 'clockz: ' + clockz.version );

	var anim1 = {
		name: 'anim1',
		loop: true,
		loopStart: 1,
		loopEnd: 2,
		loopRepeat: 5,
		frames: [
			{
				properties: { left: 300, opacity: 0.2, width: 200, height: 200 },
				duration: 1000,
				easing: 'swing'
			},
			{
				properties: { top: 300,	opacity: 1 },
				duration: 1000,
				easing: 'swing'
			},
			{
				properties: { top: 10, left: 10, width: 150, height: 150 },
				duration: 1000,
				easing: 'swing'
			}
		]					
	};

	var anim2 = {
		name: 'anim2',
		loop: true,
		frames: [
			{
				properties: { top: 300 },
				duration: 2000,
				easing: 'swing'
			},
			{
				type: 'transit',
				properties: { rotate: '+=30', },
				duration: 400,
				easing: 'fast'
			},
			{
				properties: { left: 500, opacity: 0.2 },
				duration: 1000,
				easing: 'swing'
			},
			{
				type: 'transit',
				properties: { rotate: '+=30' },
				duration: 400,
				easing: 'fast'
			},
			{
				properties: { top: 10, left: 10, opacity: 1 },
				duration: 1000,
				easing: 'swing'
			}
		]					
	};

	// redefine a clockz hook function to manage
	// jQuery, Transit and Greensock animation frameworks				
	clockz.playHook = function(node, frame, callback) {
		var duration = frame.duration || 400;
		var properties = frame.properties || null;			
		if (properties) {
			var jnode = $(node); // node selector (ex: '.class','#id' etc..)
			if (!jnode) {
				this.error( 'playHook(): node is invalid.' );
				return;					
			}
			var type = frame.type || 'jquery';
			var easing = frame.easing || 'swing';				
			switch (type) {
				// handle jQuery frames
				case 'jquery':
		                	$(node).animate(properties, duration, easing, callback);
		                	break;
				// handle Transit frames
				case 'transit':
					$(node).transition($.extend({
						duration: duration,
						easing: easing,
						complete: callback
					}, properties));
					break;
				// handle Greensock frames
				case 'greensock':
					// ...
					break;
			}
		}
		else {
			setTimeout(callback, duration); // to pause animation when no frame properties found
		}               
	};

	clockz.create('#block1', anim1);	// link an anim1 with #block1
	clockz.create('#block2', anim2);	// link an anim2 with #block2
	clockz.playAll();					// play all animations
});

Donations

❤️ Donations are always welcome ❤️ .

Coins Symbols Addresses
Bitcoin BTC 3B52fbzNFQTaKZxWf5GrCUsASD2UP8na4A
Ethereum ETH 0x1C389f1f85Cdb3C2996b83fAc87E496A80698B7C
You might also like...

Javascript library for typing animation

typebot Javascript library for typing animation Usage: include script src="typebot.js"/script And in js new typebot(element,speed,delay,text,blink

Oct 18, 2022

A simple but powerful tweening / animation library for Javascript. Part of the CreateJS suite of libraries.

TweenJS TweenJS is a simple tweening library for use in Javascript. It was developed to integrate well with the EaselJS library, but is not dependent

Jan 3, 2023

JavaScript library to make drawing animation on SVG

JavaScript library to make drawing animation on SVG

vivus.js Demo available on http://maxwellito.github.io/vivus Play with it on Vivus Instant Vivus is a lightweight JavaScript class (with no dependenci

Jan 3, 2023

jQuery plugin for color manipulation and animation support.

jQuery Color Supported jQuery versions: 1.8+ Browser Support jQuery Color 3.x supports the following browsers: Desktop: Chrome: (Current - 1) and Curr

Dec 5, 2022

Lightweight Loading Animation

Lightweight Loading Animation

◼️ Features: 🛠 Easy to Use 🌠 Fast & Lightweight (0.5Kb) 💪 No dependencies, built with VanillaJS 🌎 Tested in all modern browsers ◼️ Demo: https://b

Sep 1, 2022

An animation library, built on the Web Animations API for the smallest filesize and the fastest performance

motion-signals A wrapper over Motion One, An animation library, built on the Web Animations API for the smallest filesize and the fastest performance.

Dec 27, 2022

A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.

A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.

Letter Shuffle Animation for a Menu A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item

Dec 4, 2022

A web tool for you to record your face and turn it into a 3D animation file.

A web tool for you to record your face and turn it into a 3D animation file.

Web Face Capture A free, open-source web tool for you to record your face and turn it into a 3D animation file. Go to the website Allow camera permisi

Jan 6, 2023

A plugin that provides utilities for animation property.

tailwindcss-animation-property A plugin that provides utilities for animation property. Not only does the plugin provide the usual animation propertie

Sep 23, 2022
Owner
Tierry Danquin
Full Stack Genius Geek ;-)
Tierry Danquin
I made countdown birthday and fireworks animation using HTML Canvas, CSS, JS. The fireworks animation gonna come out once the countdown is finished or in other words, "Birthday Time".

Countdown-Birthday-Fireworks-Animation I made countdown birthday and fireworks animation using HTML Canvas, CSS, JS. The fireworks animation gonna com

Mahardika Bayu S.B 19 Dec 31, 2022
Animation library build on top of web animation API (WAAPI)

unanime.js Javascript animation library build on top of web animation API (WAAPI). Learn more about WAAPI: Web animation API Documentation Blog Daniel

Clément Laval 3 Jun 21, 2022
A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic animation.

Lava-Lamp Description: A JavaScript animation plugin for menus. It creates a div that moves when you mouse over an element, giving it an elastic anima

Richard Hung 38 Jun 4, 2022
A-Frame Element is a simple library for building fast, lightweight web components for 3D development

aframe-element is a library inspired from the very nice library Polymer lit to map A-Frame AR / VR / 3D elements on typescript classes like Angular/React/Lit.

null 6 May 31, 2022
Minimalist Web XR Location Based Markers for A-Frame 1.3.0

LBAR.js “I understand how the engines work now. It came to me in a dream. The engines don't move the ship at all. The ship stays where it is and the e

Media Engineering Institute 9 Dec 3, 2022
A-Frame components for smooth locomotion and snap turning

A-Frame locomotion A collection of A-Frame components, systems and primitives that enable all sorts of locomotion in VR. It't built to be modular, fle

Noeri Huisman 18 Sep 1, 2022
A collection of A-Frame components

Fern A-Frame Components Collection This is a collection of A-Frame components. Check the individual components for their usages and corresponding exam

Noeri Huisman 16 Dec 12, 2022
Simple rate-limiter NPM Module used for blocking IPs that exceeds certain number of requests per second in a specific time frame.

API Rate Limiter Zero-Dependencies Simple rate-limiter NPM Module used for blocking IPs that exceeds certain number of requests per second in a specif

Khaldon 7 Oct 7, 2022
A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all.

pi A devtool improve your pakage manager use experience no more care about what package manager is this repo use; one line, try all. Stargazers over t

tick 11 Nov 1, 2022
Meogic-tab-manager is an extensible, headless JavaScript tab manager framework.

MeogicTabManager English document MeogicTabManager是一个有可拓展性的、headless的JavaScript标签页管理框架。 MeogicTabManager旨在提供可自由组装页面框架、自定义页面组件、甚至覆盖框架自带事件响应的开发体验。 Meogi

meogic-tech 5 Oct 8, 2022