GithubHelp home page GithubHelp logo

muxi166 / titanic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from icons8/titanic

0.0 1.0 0.0 1.54 MB

A set of animated icons + code to insert them into the webpages

Home Page: https://icons8.com/c/animated-icons

JavaScript 76.61% HTML 23.39%

titanic's Introduction

Titanic

A collection of animated icons + javascript library.

Preview

Preview all icons

Installation

You can install it either via CDN or npm.

CDN

Insert this string to your HTML head:

<script src="https://cdn.rawgit.com/icons8/titanic/master/dist/js/titanic.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.5.9/bodymovin.min.js"></script>

And initialize it before the body closes:

<script>
    var titanic = new Titanic();
</script>

This way, you can add icons anywhere in your HTML using this tag:

<div class='titanic titanic_chat'></div>

Where chat can be any of these:

  • caps
  • chat
  • checkbox
  • expand
  • cheap
  • expensive
  • idea
  • mailbox
  • mic
  • no-mic
  • online
  • pause
  • power
  • shopping
  • smile
  • stop
  • unlock
  • zoom

Hosting your images

If you'd like to host your images on your server instead of rawgit, pass the base URL with the init() function:

titanic.begin('/my/base/directory/');

Then, if you have a div with id="chat", Titanic will search for icons in /my/base/directory/chat.json.

npm

npm install titanic-icons --save

API

  • titanic.isInitialized() -- just true/false flag

  • titanic.items -- list of titanic items

  • titanic.items[index].on(), titanic.items[index].off(), titanic.items[index].play() -- play animations of the titanic item by index

  • titanic.on(token), titanic.off(token), titanic.play(token) -- play animations of the titanic item by token (name)

Example

<head>
    <!--Inserting the scripts once for the whole page-->
    <script src="https://cdn.rawgit.com/icons8/titanic/master/dist/js/titanic.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bodymovin/4.5.9/bodymovin.min.js"></script>
</head>
<body>
    <!--Inserting an icon-->
    <div class='titanic titanic-checkbox'></div>

    <!--Initializing-->
    <script>
        var titanic = new Titanic({
          hover: true, // auto animated on hover (default true)
          click: true  // auto animated on click/tap (default false)
        });
    </script>

    <!--Clicking turns this icon on-->
    <button onclick="titanic.on(getElementById('checkbox').value)">On</button>
</body>

Credits

JavaScript is basically bodymovin plus few lines of my code. It's a solid library with an awesome name. Thank you, guys.

Icons are created by Margarita Ivanchikova from Icons8. She has many more awesome animations in her portfolio.

The code rewritten by Denis Alexanov, my teacher and guru. Thank you!

Project is produced by Icons8, author of the famous icon library, IconPharm, and Sleek Logos.

The code is created by Icons8

Magritte

titanic's People

Contributors

imargarita avatar konstantinvlasov avatar horevivan avatar visualpharm avatar dhilt 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.