Git Product home page Git Product logo

indrajithbandara / resistance-probability-estimator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danfinlay/resistance-probability-estimator

0.0 1.0 0.0 408 KB

A project for computer assisting games of "The Resistance", a table top bluffing and logic game that's REALLY hard and I thought it would be hilarious to throw a robot into the mix.

HTML 2.64% JavaScript 27.77% CSS 69.59%

resistance-probability-estimator's Introduction

#Animatron ##A simple animation package that lets you record and play back anything that can be measured and controlled using your own functions and your own data structures, and can even handle saving and loading them as JSON files. ###Currently a single Animatron will only manage a single actor's performance, although you can fit as much data as you like in each frame, so you could probably hack more. It's your processor speed! I would personally make an animatron for each actor I wanted animated.

###Example var animatron = require('animatron') animatron.register(actor1, recordingMethod, playbackMethod)

function recordingMethod(actor){
	return actor.leftArm.position
}

function playbackMethod(actor, positionData){
	actor.leftArm.position = positionData
}

//Call the tick function each frame:
function renderTick(){
	animatron.tick()
}

//One could instead also refer to these pre-defined playback methods within voxel-zigfu and voxel-recorder:
animatron.register(actor1, voxel-zigfu.currentPosition, animatron.minecraftSkinPlayback)

//Start and stop recording like this:
animatron.startRecording()
animatron.stopRecording()

//When done recording, play it back.
//Make sure you aren't updating the position
//With any other methods:
animatron.jumpToTime(0)
animatron.loop(true)
animatron.startPlayback()

//Save your recording or open it again:
animatron.saveRecording('myrecording.json')
animatron.openRecording('./myrecording.json')

##API## ###register(actor, recordingCallback, playbackCallback) Registers an actor as the performer, with callback functions for recording and playing back.

function recordingCallback(actor){

	//Includes a reference to the recorded actor.
	//You should return an object that your actor will use
	//to reenact its current position.
	return actor.leftArm.position
}

function playbackMethod(actor, positionData){
	//Includes a reference both to the actor and the positionData object you provided.
	//Just plug it together!
	actor.leftArm.position = positionData
}

###startRecording()

###tick() Must be called each frame for animation to be captured. Playback timing, however, is handled internally, to emulate the timing of the original tick calls. Currently there is no tweening, but eventually it would be nice, don't you think?

###stopRecording()

###saveRecording(filename, cb(err))

###openRecording(filePath, cb(err)) Loads a performance from file, allowing the registered actor to perform it.

###recordingLength() Returns recording length in milliseconds.

###keyframeCount() Returns number of significant recorded moments, organized by timestamp.

###currentFrame() Returns current frame number.

###currentTime() Returns current animation time in milliseconds (recordings start at 0).

###jumpToTime(milliseconds) Calls all actors' playback callbacks at the specified time.

###jumpToKeyframe(keyFrameInteger) Calls all actors' playback callbacks at the specified keyframe.

###startPlayback() Begins calling back actors' playback callbacks from the current keyframe.

###pausePlayback()

###loop(boolean) Whether or not the animation should loop when completing.

###resetPlayback()

###playbackSpeed(speed) A positive or negative number representing the speed at which to play back when playing.

###clearRecording()

resistance-probability-estimator's People

Contributors

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