Coder Social home page Coder Social logo

thanos_dust's Introduction

Thanos Dust Effect

Effects Demo

As Thanos making a snap with the Infinite Gauntlet, half the heros vanish to dust. As using the time stone, people come back.

Details

The procedures:

  1. Click the Gauntlet button, and display animation to make a snap, and play audio file;
  2. Select half heros by random, the random method is to resort members array;
arr.sort(function() {
  return 0.5 - Math.random();
});
  1. Make selected item to dust
  • 3.1 use html2canvas library to convert dom to a canvas image
  • 3.2 split the canvas images into many pieces by pixel, function generateFrames()
  • 3.3 create a container which has the same size and position as the converted dom
  • 3.4 appendChild to the container with the pieces
  • 3.5 rotate random degrees and translate random pixel for each piece, which shows the dust animation
  • 3.6 set converted dom item to be invisible and finish the SNAP action
  1. Reverse time to bring heros back by adjusting the visibility of converted dom items

FAQ

Why use a nodejs express server?

A static html file will show errors with "Unable to get image data from canvas because the canvas has been tainted by cross-origin data", even if I set allowTaint to be true.

thanos_dust's People

Watchers

James Cloos 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.