Skip to content

Instantly share code, notes, and snippets.

Avatar

nariakiiwatani nariakiiwatani

View GitHub Profile
View DelayBank.h
template<typename T>
class DelayBank {
public:
void add(const T &t, float wait_time) {
waiter_.push_back({t,wait_time});
}
void update() {
using namespace std;
ended_.clear();
float time = ofGetLastFrameTime();
View TenCircles
int x, y, index, posX[10], posY[10];
// あとでiという変数を使うので、indexに改名しました。
// iのままでも同じ動きをしますが、わかりにくくなるといけないので。
//--------------------------------------------------------------
void ofApp::setup() {
ofSetWindowShape(600, 400);
ofSetFrameRate(30);
ofSetBackgroundColor(255, 255, 255);
View boccia.glisp.glisp
(defvar jack [-38 -67.1875])
(defvar red0 [-31 -161.1875])
(defvar red1 [-119 -171.1875])
(defvar red2 [33 -116.1875])
(defvar blue0 [-115 -78.1875])
(defvar blue1 [84 50.8125])
(defvar blue2 [22 -26.1875])
(defvar blue3 [-81 -10.1875])
(defvar size 10)
(def red [red0 red1 red2])
View DebugTextEditor.tsx
// DebugTextEditor.tsx
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WI
View useStackRef.ts
// useStackRef.ts
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH TH
View useOrbitInterpolation.ts
import { useCallback } from 'react'
import * as THREE from "three"
import { useSpring } from "react-spring"
export interface OrbitParam {
position: THREE.Vector3,
target: THREE.Vector3,
up: THREE.Vector3,
fov: number,
zoom: number
View Tracker.h
// Copyright 2020 nariakiiwatani
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
View clamp_inverse_test.glisp
(defn clamp
{:inverse (fn [{:return ret :params [v min max]}]
[ret min max])}
[v min max]
(if (< v min) min
(if (> v max) max
v))
)
(defvar v 142.8125)
(style (stroke "salmon" 5)
@nariakiiwatani
nariakiiwatani / splatoon2_20200710
Created Jul 10, 2020
スプラトゥーンリーグマッチをやりながら自分の声だけ音声認識した結果
View splatoon2_20200710
幸運
-
それがばれない方がいいな
-
野良でやってて 重ねられた時の
-
キツネ
@nariakiiwatani
nariakiiwatani / set opacity by layer makers
Last active Jan 15, 2021
AfterEffects Expression Utils
View set opacity by layer makers
// demo: https://twitter.com/nariakiiwatani/status/1280689913202016256
const fadeIn = 0.2, fadeOut = 0.4,
lerp = (x, x0, x1, y0, y1) => (y0 + (y1 - y0) * (x - x0) / (x1 - x0)),
off = 0,
on = 1,
calcAlpha = (time, from, to, fadeIn, fadeOut) => (clamp(Math.min(lerp(time, from, from+fadeIn, off, on), lerp(time, to-fadeOut, to, on, off)),off,on));
([...Array(marker.numKeys).keys()]
.map(i=>marker.key(i+1))
.reduce((acc, m) => acc+calcAlpha(time, m.time, m.time+m.duration, fadeIn, fadeOut), 0))