Skip to content

Instantly share code, notes, and snippets.

@kenjiSpecial
kenjiSpecial / jsdoit.css
Created December 13, 2012 11:00
js_test:: array manupulation
body { background-color: #DDDDDD; font: 30px sans-serif; }
@kenjiSpecial
kenjiSpecial / animation.coffee
Last active February 10, 2016 17:51
useful animation function for coffeescript
window.requestAnimationFrame = do ->
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
(callback) -> window.setTimeout(callback, 1000 / 60)
@kenjiSpecial
kenjiSpecial / ball.h
Created March 19, 2013 10:09
easy ball.h file for openFrameworks.
#import "ofMain.h"
class Ball{
public:
ofPoint pos;
ofColor col;
ofColor touchCol;
bool bDragged;
@kenjiSpecial
kenjiSpecial / testApp.cpp
Created March 19, 2013 10:52
easy calculating of time for openFrameworks.
//--------------------------------------------------------------
void testApp::update(){
// receiving the float value
curTime = ofGetElapsedTimef();
dt = curTime - lastTime;
lastTime = curTime;
}
@kenjiSpecial
kenjiSpecial / Ball.h
Created March 19, 2013 11:18
easy spring test on openFramework
#import "ofMain.h"
class Ball{
public:
ofPoint position;
ofPoint velocity;
ofPoint accel;
float spring;
float friction;
@kenjiSpecial
kenjiSpecial / main.js
Last active December 15, 2015 06:09
- mouse event on PC and touch event on Mobile.
var mobileStatus;
var agent = navigator.userAgent;
// check whether the device is mobile or not.
if(agent.search(/iPhone/) != -1 || agent.search(/iPad/) != -1 || agent.search(/iPod/) != -1 || agent.search(/Android/) != -1){
mobileStatus = true;
}else{
mobileStatus = false;
}
@kenjiSpecial
kenjiSpecial / style.sass
Created March 21, 2013 16:41
scss/sass file for canvas full screen site .
@import "compass"
@import "compass/reset"
html, body
margin: 0
padding: 0
width: 100%
height: 100%
overflow: hidden
@kenjiSpecial
kenjiSpecial / easelJS_drag.html
Created March 22, 2013 09:33
Useful tutorial : EaselJS / tutorials / Mouse Interaction / drag.html by lannymcnie https://github.com/CreateJS/EaselJS/blob/master/tutorials/Mouse%20Interaction/drag.html
<!DOCTYPE html>
<html>
<head>
<title>EaselJS demo: Dragging</title>
<link href="../shared/demo.css" rel="stylesheet" type="text/css">
<script src="../../lib/easeljs-0.6.0.min.js"></script>
<script>
var stage, output;
function init() {
@kenjiSpecial
kenjiSpecial / view.coffee
Created March 22, 2013 10:46
simple external class in coffeescript
class this.View
constractor: ->
@kenjiSpecial
kenjiSpecial / addEventListener.coffee
Created March 22, 2013 12:19
addEventListener in coffeescript file.
# example
dragger.addEventListener "mousedown", (event) =>
@controller.cn_mouse_down(event)