Giter Club home page Giter Club logo

tiny-dwitter's Introduction

Tiny Dwitter

A tweet-sized clone of lionleaf's dwitter in 139 bytes.

<body onload="setInterval('t=new Date/1e3;R=(...z)=>`rgba(`+z;x=c.getContext`2d`;with(Math)eval($.value)',16)"><input id=$><p><canvas id=c>

Try it out here!

Instructions

  • Your function is called every ~16 ms (roughly 60-ish times per second).
  • t - Current timestamp in seconds.
  • sin - Shorthand for Math.sin.
  • cos - Shorthand for Math.cos.
  • tan - Shorthand for Math.tan.
  • R - Function that generates rgba-strings, usage ex.: R(255, 255, 255, 0.5)
  • c - A 300x150 canvas.
  • x - A 2D context for that canvas.

Compromises/Differences From Dwitter

  • The canvas is the default size of 300 x 150 instead of 1920 x 1080.
  • requestAnimationFrame is not used, instead an approximation of 60-ish fps is achieved with a 16ms interval.
  • t variable is not a seconds counter starting from 0. Instead, it is the current timestamp in seconds.
  • Trig method shortcuts are sin cos and tan instead of S C and T. Bonus: All Math methods are available too!
  • Arguments passed to R are not optional and are not automatically converted to numbers.
  • 140 character limitation is not implemented (I had to scrap it to include the R() function and stay under 140 bytes ๐Ÿ˜ž)

Greetz

  • Special thanks to p01 for being my golf caddy on this.

tiny-dwitter's People

Contributors

nderscore avatar

Watchers

ming 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.