Giter Site home page Giter Site logo

krazune / shyleopard.js Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 25 KB

A JavaScript bubbly image generator (heavily inspired by Vadim Ogievetsky's www.koalastothemax.com).

Home Page: https://krazune.github.io/ShyLeopard/

License: MIT License

JavaScript 100.00%
javascript pure-javascript svg canvas mit-license

shyleopard.js's Introduction

ShyLeopard.js

A JavaScript bubbly image generator (heavily inspired by Vadim Ogievetsky's koalastothemax.com).


Version

Current version: 2021.12.1

The version format is "<year>.<zero padded month>.<revision number>".


License

MIT License


Live example

ShyLeopard.js GitHub.io


Usage

After the script is included in the document, it can be used as follows:

let targetContainer = document.getElementById("target"); // Target container for the SVG element.
let layerCount = 4; // How many layers of bubbles.
let smallCellSize = 4; // Size of the smallest bubble.
let transitionTimer = 0; // Amount of seconds for the transition (0 = transitions disabled).

let bubbler = new ShyLeopard.Bubbler(targetContainer, layerCount, smallCellSize, transitionTimer);

console.log("ShyLeopard Version: " + ShyLeopard.getVersion()); // Version string (for example: "2020.11.1").

// Only one function can be added to the complete event (it can be removed by passing null to the function).
bubbler.onComplete(function()
	{
		console.log("COMPLETED!");
	});

// Only one function can be added to the pop event (it can be removed by passing null to the function).
bubbler.onPop(function(event)
	{
		console.log(event.layer); // Layer of the popped bubble.
		console.log(event.row); // Row of the popped bubble.
		console.log(event.column); // Column of the popped bubble.
	});

bubbler.generate(image); // The parameter is an instance of HTMLImageElement (and must be created before this call).

Notes

This generates an SVG element inside the target container, and all circles are created inside this element.

Canvases are used to read, and resize, the source image into the different layers.

This was created for entertainment, and educational purposes.

shyleopard.js's People

Contributors

krazune avatar

Stargazers

Alex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.