rafl

WebJar for rafl

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

rafl
Last Version

Last Version

1.2.2
Release Date

Release Date

Type

Type

jar
Description

Description

rafl
WebJar for rafl
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/michaelrhodes/rafl

Download rafl

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/rafl/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>rafl</artifactId>
    <version>1.2.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/rafl/
implementation 'org.webjars.npm:rafl:1.2.2'
// https://jarcasting.com/artifacts/org.webjars.npm/rafl/
implementation ("org.webjars.npm:rafl:1.2.2")
'org.webjars.npm:rafl:jar:1.2.2'
<dependency org="org.webjars.npm" name="rafl" rev="1.2.2">
  <artifact name="rafl" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='rafl', version='1.2.2')
)
libraryDependencies += "org.webjars.npm" % "rafl" % "1.2.2"
[org.webjars.npm/rafl "1.2.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : global jar [4.3.0,4.4)

Project Modules

There are no modules declared in this project.

rafl

A fork of the seemingly-abandoned component/raf with added support for IE 11, web workers, and node.

Build status

Install

$ npm install rafl

Example

Request the animation frame with raf(fn), cancel with raf.cancel(id).

var raf = require('rafl')

var x = 0
var y = 50
var canvas = document.querySelector('canvas')
var ctx = canvas.getContext('2d')

function animate() {
  raf(animate)
  draw()
}

var prev = Date.now()
function draw() {
  var curr = Date.now()
  var diff = curr - prev
  var p = diff / 16
  ctx.clearRect(0, 0, 900, 300)
  ctx.beginPath()
  ctx.globalAlpha = .5
  ctx.arc(x, y, 10, 0, Math.PI * 2, false)
  ctx.fill()
  x += 2
  y += Math.sin(x/20) * 5
  prev = curr
}

animate()

Page weight (browserified)

compression size
rafl.js 1.66 kB
rafl.min.js 1.14 kB
rafl.min.js.gz 523 B

License

MIT

Versions

Version
1.2.2