Skip to content

Instantly share code, notes, and snippets.

View caubry's full-sized avatar
🌵

Caroline Aubry caubry

🌵
View GitHub Profile
module.exports = function(grunt) {
grunt.initConfig({
jshint: {
files: ['js/*'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
requestId: 0,
settimeoutID: 0,
move: function(keyCode) {
var _this = this;
// Frame per seconds
var fps = 15;
if (this.requestId === 0) {
(function animationLoop() {
requestId: 0,
move: function() {
var _this = this;
if (this.requestId === 0) {
(function animationLoop() {
_this.render();
_this.requestId = requestAnimationFrame(animationLoop, _this.move);
})();
@caubry
caubry / keybase.md
Created September 18, 2014 08:46
Some Checking

Keybase proof

I hereby claim:

  • I am caubry on github.
  • I am lilydrop (https://keybase.io/lilydrop) on keybase.
  • I have a public key whose fingerprint is 29B3 4BA8 CDC6 5D2E A6ED 6128 1B77 24CD 5619 290F

To claim this, I am signing this object:

import MouseTrail.Interface;
class MouseTrail.Main
{
private static var m:Main;
var int:Interface;
public function Main(root:MovieClip)
{
int = new Interface(root);
# !/bin/bash
ROOT= ~/Desktop/TODO
mtasc $ROOT/mousetrail/src/MouseTrail/Main.as -main
-swf $ROOT/mousetrail/bin/mouseTrail.swf
-out $ROOT/mousetrail/bin/Interface.swf
-cp $ROOT/mousetrail/src
open $ROOT/mousetrail/bin/Interface.swf
class MouseTrail.Interface
{
private var pen:MovieClip;
public function Interface (root:MovieClip)
{
var c:MovieClip= root.createEmptyMovieClip("test", root.getNextHighestDepth());
// Do something
}
// emptyMovieClip as a MovieClip - x & y at 0
// Rectangle( x, y, width, height )
var currentRect:Rectangle = new Rectangle( 0, 0, 50, 50 );
var mc:MovieClip = emptyMovieClip.createEmptyMovieClip("mc", emptyMovieClip.getNextHighestDepth());
drawRectangle( mc, currentRect.x, currentRect.y, currentRect.width, currentRect.height, 0x000000, 100, 1, 0x000000, 100 );
private function drawRectangle(mc:MovieClip, rectX:Number, rectY:Number, rectWidth:Number, rectHeight:Number, fillColor:Number, fillAlpha:Number, lineThickness:Number, lineColor:Number, lineAlpha:Number)
{
@caubry
caubry / Distance.as
Last active December 13, 2015 17:09
private function calculateDistance(xPos:Number, yPos:Number, xPos2:Number, yPos2:Number):Number
{
var diffX:Number = xPos - xPos2;
var diffY:Number = yPos - yPos2;
var distance:Number = Math.sqrt(diffX * diffX + diffY * diffY);
if (distance < 0)
{
distance *= 1;
private function calculateAngle( xPos:Number, yPos:Number ):Number
{
var pA:Point = new Point( 240, 180 );
var pB:Point = new Point( xPos, yPos );
var AP:Point = new Point( 0, 10 );
var BP:Point = new Point( ( pA.x - pB.x ), ( pA.y - pB.y ) );
var D:Number = ( AP.x * BP.x ) + ( AP.y * BP.y );