Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
flipnote.js
Advanced tools
API for handling Flipnote Studio's animation formats, capable of real-time playback using webGL
Enables browser-based playback of the proprietary animation formats used by Flipnote Studio and Flipnote Studio 3D, powered by WebGL.
I hope that maybe in the long term it will serve some use in archiving Flipnote animations, epecially given that the online services for both applications have been closed down.
.ppm
) and Flipnote Studio 3D (.kwz
)Check out Flipnote Player for a live demo. :)
$ npm install flipnote.js --save
Then if you are using a module bundler like Webpack or Rollup, import flipnote.js into your project:
// Using ES6 module syntax
import flipnote from "flipnote.js";
// Using CommonJS
var flipnote = require("flipnote.js");
Drop this script into the of your page's HTML:
When you manually include the library like this, flipnote.js will be made globally available on window.flipnote
Development version Uncompressed, with source comments included. Intended for debugging.
Production version Minified and optimized version.
To create a new player, we need to make a HTML canvas element with a unique identifier (an id
attribute works well!) to act as a display for the player.
Make sure that your canvas dimensions match the 3:4 aspect ratio used by Flipnotes.
<canvas id="player-canvas" width="512" height="384"></canvas>
Then we can use some JavaScript to create a new instance of flipnote.player
, and tell it to use the container element we just made by providing a matching CSS selector, and the canvas' width
and height
.
Please note that this javascript must be placed after the <canvas>
element in your HTML
var player = new flipnote.player("#player-canvas", 512, 384);
After the player has been created, then a Flipnote can be loaded from a URL:
// create a player (as in the previous step)
var player = new flipnote.player("#player-canvas", 512, 384);
player.open("www.example.com/path/to/demo.ppm");
Arguments:
{String | HTMLCanvasElement} canvas
{Number} width
{Number} height
Flipnote type; either "KWZ" for 3DS notes or "PPM" for DSi notes.
The underlying Flipnote parser object that the player is using.
Get the Flipnote duration in seconds.
Get the Flipnote framerate as frames per second.
Get/set the index of the current frame being shown. When set to a new value the player will automatically jump to that frame.
Get/set the current playback prosition in seconds, modelled after the HTMLMediaElement property of the same name. When set to a new value the player will automatically jump to that time.
Get/set the playback progress as a percentage out of 100.
Get/set the Flipnote audio volume. This should be a value between 0 and 1.
Get/set whether the Flipnotes' audio should be muted.
Get/set whether the Flipnote should loop back to the start when it reaches the end.
An object containing details about the Flipnote, such as the author, timestamp, etc. This will be slightly different depending on the Flipnote type
An object containing the visibility status for each layer, e.g. { 1: true, 2: true, 3: true }
Begin Flipnote playback.
Pause Flipnote playback.
Register an event callback. See Events for all event types.
Arguments:
{String} eventType
{Function} callback
Example:
player.on("playback:start", function() {
// do something...
})
Remove an event callback that was registered with on
Arguments:
{String} eventType
{Function} callback
Jump to a specified frame in the Flipnote.
Arguments:
{Number} index - frame index
Jump to the next frame in the Flipnote. If loop
is true
and the Flipnote is on its last frame, it will jump to the first frame.
Jump to the previous frame in the Flipnote. If loop
is true
and the Flipnote is on its first frame, it will jump to the last frame.
Jump to the first frame in the Flipnote.
Jump to the last frame in the Flipnote.
Jump to the frame being used as the Flipnote's thumbnail.
Enable/disable layer visibility.
Arguments
{Number} layer
- Layer (either 1, 2, or 3){Boolean} isVisible
- Set to false
to hide layerResize the player canvas.
Arguments:
{Number} width
- New player width in pixels{Number} height
- New player height in pixelsForce the player to refresh.
Wipes all of the event listeners currently added to the player object.
Emitted when the player has finished loading a KWZ / PPM file.
Emitted if the player detected an error when playing the Flipnote file.
Emitted whenever currentTime
updates.
Emitted whenever the current frame changes.
Emitted whenever playback begins.
Emitted whenever playback is paused/stopped.
Emitted whenever the Flipnote playback has finished (and loop=false).
Emitted whenever the Flipnote is about to enter another playback loop (and loop=true).
This project is licensed under the MIT License - see the LICENSE.md file for details.
Install dependencies:
npm install
Produce build files:
npm run build
Run development server:
npm start
FAQs
A JavaScript library for parsing, converting, and in-browser playback of the proprietary animation formats used by Nintendo's Flipnote Studio and Flipnote Studio 3D apps.
The npm package flipnote.js receives a total of 8 weekly downloads. As such, flipnote.js popularity was classified as not popular.
We found that flipnote.js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.